Can't see numpy etc after upgrading Python on Ubuntu

ozpeterballard at gmail.com ozpeterballard at gmail.com
Tue Dec 20 01:19:44 EST 2016


Thanks Chris for replying, but it didn't work. The upgrade happened, but still python can't see numpy! So it seems to be a path problem. The numpy (and scipy and matplotlib) files are there, so surely in principle it's a simple matter of pointing my python path at them?

Any ideas how?

(I should add, the reason I upgraded python from source in the first place is that "apt-get" claimed python was up to date).

p.s. Here's an abridged log:

peter at sirboris:~$ which python
/usr/local/bin/python

peter at sirboris:~$ pip
The program 'pip' is currently not installed.  You can install it by typing:
sudo apt-get install python-pip

peter at sirboris:~$ sudo apt-get install python-pip
[lots of output, pip installed]

peter at sirboris:~$ which pip
/usr/bin/pip

peter at sirboris:~$ sudo pip install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/lib/python2.7/dist-packages
Cleaning up...

peter at sirboris:~$ sudo pip install numpy --upgrade
[lots and lots of output, successful install]

peter at sirboris:~$ python
Python 2.7.12 (default, Dec 11 2016, 22:16:38) 
[GCC 4.6.3] on linux2
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
>>> import sys
>>> sys.path
['', '/home/peter', '/home/peter/dvd/software/python', '/home/peter/Cython-0.25.2', '/usr/local/lib/python27.zip', '/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-linux2', '/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', '/usr/local/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/site-packages']

# [Then I thought, maybe "pip" and "python -m pip" are different, so...]

peter at sirboris:~$ sudo python -m pip install numpy
/usr/local/bin/python: No module named pip


More information about the Python-list mailing list