简体   繁体   中英

Numpy Install on Mac 10.8.4

I am new to python/numpy/programming in general. I pip installed numpy. Here's its path:

/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

Then, when I enter the python shell, I type in import numpy and get:

ImportError: No module named numpy

This is what it looks like overall:

MacBook-Air:desktop tvska$ pip install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Cleaning up...
MacBook-Air:desktop tvska$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named numpy

Any advice would really be appreciated!

I believe the issue is that your pip is linking to the incorrect python version. If /Library/Frameworks/Python.framework/Versions/2.7/bin/pip does not exist redownload pip, go to the pip folder and type python setup.py install . This will reinstall pip for the current python version (If its a fresh version you may need to install setup tools also).

Check to make sure that your /Library/Frameworks/Python.framework/Versions/2.7/bin is at the front of your $PATH. I think this is likely the case as it looks like this is a osx binary install and it does this automatically. Then you can use pip to install whatever you need to the correct python version.

If you are not familiar with installations such as these and just want the scipy suite you can download anaconda as an executable from https://store.continuum.io and it will setup everything for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM