Python cannot find numpy

I tried to follow the instruction from this link: http://www.thisisthegreenroom.com/2011/installing-python-numpy-scipy-matplotlib-and-ipython-on-lion/ However, it seems my python cannot find Numpy, Scipy and everything I install using pip.

Right now when I write which python it shows / usr / local / bin / python . However, when I type

  pip install numpy

      

shows

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

      

So they appear to be in a different directory and I probably installed them earlier numpy

, which makes pip keep telling me that they are installed. I wonder if there is any way?

i tried to import it.

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

      

I also tried uninstalling numpy and installing it again. However, when I remove it. This is still giving me an error.

    applematoMacBook-Air:~ apple$ pip uninstall numpy
    DEPRECATION: Uninstalling a distutils installed project (numpy) has been     deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling numpy-1.8.0rc1:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info
    Proceed (y/n)? y
    Exception:
    Traceback (most recent call last):
    File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/basecommand.py", line 246, in main
    status = self.run(options, args)
    File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/commands/uninstall.py", line 70, in run
    requirement_set.uninstall(auto_confirm=options.yes)
    File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_set.py", line 274, in uninstall
    req.uninstall(auto_confirm=auto_confirm)
    File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_install.py", line 730, in uninstall
  paths_to_remove.remove(auto_confirm)
    File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/req/req_uninstall.py", line 126, in remove
    renames(path, new_path)
    File "/usr/local/lib/python2.7/site-packages/pip-6.1.1-py2.7.egg/pip/utils/__init__.py", line 292, in renames
  shutil.move(old, new)
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 302, in move
    os.unlink(src)
  OSError: [Errno 13] Permission denied: '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

      

+3


source to share


2 answers


It looks like the version pip

you are using is the default for the entire default python interpreter /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

, not installed in /usr/local/bin

.



I pretty much had the same problems until I started using homebrew . I would recommend looking at this page on brew and python . You may need to uninstall pip

and reinstall it from brew

. Btw using brew

, no need for sudo

.

+2


source


try: pip uninstall numpy

and then: pip install numpy



... and try it with sudo: sudo pip install numpy

0


source







All Articles