1

As I know this seems to be a common question, I have looked at the other threads and can't seem to figure out how to apply to my own situation. The threads I have looked at so far are: NumPy in IDLE (Python 3.3.2) on Mac OSx 10.8 Install Numpy on Mac OS X Lion 10.7

I have installed the version 3.4 of Python from the main Python.org website, and have been accessing it via the IDLE application. I recently decided to try and add the SciPy packages via Macports and have run into difficulty.

I successfully downloaded and installed the SciPy packages, but when I try and import numpy (or matplotlib etc.) i get the following message:

>>> import numpy
Traceback (most recent call last):
  File "<pyshell#17>", line 1, in <module>
    import numpy
ImportError: No module named 'numpy' 

I have verified that numpy (and the other SciPy components) is installed, and is at the following location:

/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/port

Also if I try to use pip install numpy, I get the following:

Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Cleaning up...

I presume the problem is that IDLE is not linking to the new components, but I'm not sure how to resolved this. I have tried to run the following in the terminal window:

export PYTHONPATH=/Library/Python/2.7/site-packages:$PYTHONPATH

But this hasn't made any difference that I can see, and I am a little lost as to where to go from here.

If it's relevant when i run which python from the terminal window, i get the following result:

/usr/bin/python

I am running a Macbook Pro 2011, with OSX 10.9 (Mavericks). I am also very new to programming and terminal interfaces, so please try and give a simple answer if possible.

Community
  • 1
  • 1
  • It sounds like you've installed numpy for python2.7 but not for your python3.4 install. When you have multiple versions of python installed, the libraries, etc, are completely independent. When you're calling `pip`, it looks like you're calling the python2.x one instead of the python3.x pip. (See what `pip --version` outputs. At the end it will say which version of python it's for.) Try calling `pip-3.4 install numpy` (assuming you've installed pip on your python3.x installation). – Joe Kington Mar 26 '14 at 19:08
  • Also, if you're a new user just trying to get working installation of Python and the common scientific packages, [use Anaconda](https://store.continuum.io/cshop/anaconda/). It will not clobber any existing installations. But if you follow the default installation, it will make itself the default `python` and `ipython` on your system. – Dan Allan Mar 26 '14 at 20:04
  • Thanks for the pointer to Anaconda - this seems like the easiest solution while I get to grips with the basics of python and terminal windows. – user3465532 Mar 30 '14 at 18:37

0 Answers0