1

I've got both Python2.7 and Python3.4 installed on my computer.

I've installed Numpy for both 2.7 and 3.4, but can't figure out how to specify the PYTHONPATH variable so that 2.7 uses Numpy2.7 and 3.4 uses Numpy3.4. Is there a Python3-specific path variable I can set?

2
  • How did you install numpy? You shouldn't need to set PYTHONPATH at all if you've properly installed modules; they should already be in the default sys.path. Commented Jul 31, 2014 at 15:07
  • 1
    when you use python 3 you will be using the numpy installed for python 3 and vice versa for python 2 unless you have screwed something up. Commented Jul 31, 2014 at 17:27

1 Answer 1

1

As @Wooble said, you shouldn't need to set PYTHONPATH at all if you've properly installed modules.

To verify whether you are picking up the right files, go to your shell, and there, run the following

$ python2.7

>>> import numpy

>>> numpy.version # This prints file path to numpy
<module 'numpy.version' from '/home/user/ENV/local/lib/python2.7/site-packages/numpy/version.pyc'>

>>> numpy.version.full_version
'1.8.1'

By using the above, you can ensure that you are using the correct versions.

Sign up to request clarification or add additional context in comments.

4 Comments

How can I properly install the modules so that 2.7 and 3.4 seek them in different paths?
@Megatron I thought you already installed them? What happens if you run the commands I said in console?
I get ImportError: No module named 'numpy' when I know the 3.4 is installed via macports. I'll have to check a bit more.
Found out I have multiple python 3.4 binaries. Solved. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.