2016-05-12 12 views
0

Ich hatte etwas Code, der gerade gut lief, und im Laufe des Tages habe ich etwas kaputt gemacht, und jetzt kann ich keine Python-Module installieren. Insbesondere brauche ich numpy, matplotlib und Kissen. Ich kann keine von ihnen installieren.Python-Module nicht installiert

Aber der seltsame Teil ist, dass sie beide einfach gut installieren erscheinen:

$ sudo pip install numpy 
Collecting numpy 
    Downloading numpy-1.11.0-cp27-cp27mu-manylinux1_x86_64.whl (15.3MB) 
    100% |████████████████████████████████| 15.3MB 94kB/s 
Installing collected packages: numpy 
Successfully installed numpy-1.11.0 

Oder wenn ich versuche:

$ sudo apt-get install python-numpy 
Reading package lists... Done 
Building dependency tree  
Reading state information... Done 
Suggested packages: 
    python-nose python-numpy-dbg python-numpy-doc 
The following NEW packages will be installed: 
    python-numpy 
0 upgraded, 1 newly installed, 0 to remove and 20 not upgraded. 
Need to get 0 B/1,763 kB of archives. 
After this operation, 9,598 kB of additional disk space will be used. 
Selecting previously unselected package python-numpy. 
(Reading database ... 221259 files and directories currently installed.) 
Preparing to unpack .../python-numpy_1%3a1.11.0-1ubuntu1_amd64.deb ... 
Unpacking python-numpy (1:1.11.0-1ubuntu1) ... 
Processing triggers for man-db (2.7.5-1) ... 
Setting up python-numpy (1:1.11.0-1ubuntu1) ... 

ich Python bin mit 2.7, und ich bin auf Ubuntu 16.04.

$ python 
Python 2.7.5 (default, May 12 2016, 13:11:58) 
[GCC 5.3.1 20160413] 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 
>>> 

Es tut dies für jedes Modul, das ich versuche und installiere. Jede Hilfe würde sehr geschätzt werden.

+0

Was sind die Ausgaben von 'which python' und' sudo pip -V'? –

+0

pip 8.1.2 from /usr/local/lib/python2.7/dist-packages (python 2.7) –

+0

Könnte es sein, dass Sie mehrere Python-Installationen haben und nur numpy zu einem von ihnen installiert haben? – roadrunner66

Antwort

0

Dies ist ein Ergebnis der Standard python und der Standard pip nicht zusammenpassen. Um sicherzustellen, dass Pakete an die richtige Stelle installiert werden, zu verwenden:

python -m pip install $PACKAGE

Daraus ergibt sich die pip auf die gewünschte python zugewiesen wird, eher als die erste in Ihrem Pfad gefunden.