2014-01-18 10 views
19

Ich bin neu in Anaconda Version von Python, und schon stoße ich auf unangenehme Probleme.Anaconda nicht gefunden meine Pakete mit `pip` installiert

Ich installierte Anaconda pro the instructions here, und es funktionierte wie Charme, mit allen enthaltenen Paketen ordnungsgemäß importiert, wenn gefordert. Dann ging ich auf ein paar zusätzliche Pakete zu installieren, die Anaconda nicht mit pip in erster Linie eingeschlossen hat:

$ sudo pip install BeautifulSoup mrjob pattern 

Die Installationen, perfekt zu sein scheint, aber wenn ich versuche, sie in ipython zu importieren, werden die Dinge frustrierend:

Python 2.7.6 |Anaconda 1.8.0 (64-bit)| (default, Nov 11 2013, 10:47:18) 
Type "copyright", "credits" or "license" for more information. 

IPython 1.1.0 -- An enhanced Interactive Python. 
?   -> Introduction and overview of IPython's features. 
%quickref -> Quick reference. 
help  -> Python's own help system. 
object? -> Details about 'object', use 'object??' for extra details. 

In [1]: import BeautifulSoup 
--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-1-aa1e12a76f5e> in <module>() 
----> 1 import BeautifulSoup 

ImportError: No module named BeautifulSoup 

In [2]: import mrjob 
--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-2-6ea1b9bda48b> in <module>() 
----> 1 import mrjob 

ImportError: No module named mrjob 

In [3]: import pattern 
--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-3-4b662941bac1> in <module>() 
----> 1 import pattern 

ImportError: No module named pattern 

In [4]: 

Lustige Sache ist, können diese Pakete sehr gut importiert werden, wenn ich nicht das Anaconda Bündel von python läuft, nach dem Entfernen

# added by Anaconda 1.8.0 installer 
export PATH="/home/username/anaconda/bin:$PATH" 

fr om mein .bashrc:

Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
Type "copyright", "credits" or "license" for more information. 

IPython 0.13.2 -- An enhanced Interactive Python. 
?   -> Introduction and overview of IPython's features. 
%quickref -> Quick reference. 
help  -> Python's own help system. 
object? -> Details about 'object', use 'object??' for extra details. 

In [1]: import BeautifulSoup 

In [2]: import mrjob 

In [3]: import pattern 

In [4]: 

Habe ich irgendetwas während jeder dieser Installationen vermissen, die ich lief? Soll ich diese Pakete manuell mit Anaconda verknüpfen, damit sie weiß, wo sie zu finden sind?

+0

Was gibt 'pip' aus? Enthält '/ home/username/anaconda/bin'' pip'? Was ist mit 'easy_install'? – icktoofay

+0

'die pip' Ausgänge'/usr/bin/pip' und '~/anaconda/bin /' enthält 'pip'. 'easy_install' verhält sich ungefähr gleich. – alxyzc

+0

heißt das, ich sollte '~/anaconda/bin/pip' anstelle des Systems' pip' verwenden? – alxyzc

Antwort

20

In den Kommentaren wurde festgestellt, dass pip in Verwendung war /usr/bin/pip; mit anderen Worten, das System pip. Das System pip wird in das System site-packages installiert, nicht Anacondas site-packages.

Die Lösung besteht darin, sicherzustellen, dass Sie Anacondas pip bei der Installation von Paketen zur Verwendung mit Anaconda verwenden.

+2

Danke! Ich wusste nicht, dass Sie 'pip' verwenden können, um Pakete in einer 'Conda'-Umgebung zu installieren. – osa

+0

Und unter Windows ist Anacondas Pip im Verzeichnis Anaconda/script – MARK

+2

Ubuntu 16.04, conda für Python 3. Mein conda pip war in ~/anaconda3/bin/pip. Ich habe einen Alias ​​in meinem ~/.bashrc wie 'alias condapip = ~/anaconda3/bin/pip' gemacht, damit ich 'sudo condapip install somepackage' ausführen kann – wordsforthewise

Verwandte Themen