BeautifulSoup nach Installation über Pip nicht gefunden

5538
Chris Poole

Ich benutze Homebrew, um Python auf Snow Leopard zu installieren.

Nach der Installation von Python (2.7.2) füge ich /usr/local/share/pythondie Vorderseite meines hinzu PATH. Ich habe auch PYTHONPATHzu /usr/local/lib/python2.7/site-packages.

Wenn ich zum Beispiel lxml oder feedparserpip installiere, kann ich nach dem Laufen kein Problem mehr haben.pythonimport lxml

Nach dem Ausführen pip install BeautifulSoupgibt es ein .egg-infoVerzeichnis für BeautifulSoup site-packagessowie das bs4Verzeichnis in dem oben aufgelisteten Verzeichnis, aber es wird from BeautifulSoup import BeautifulSoupnur ein Fehler im Python-Interpreter angezeigt.

sys.path ist:

['',  '/usr/local/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages/pip-1.0.2-py2.7.egg',  '/Users/Chris/src/python-pinboard',  '/usr/local/lib/python2.7/site-packages',  '/usr/local/Cellar/python/2.7.2/lib/python27.zip',  '/usr/local/Cellar/python/2.7.2/lib/python2.7',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-darwin',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-mac',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/plat-mac/lib-scriptpackages',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-tk',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-old',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/lib-dynload',  '/usr/local/Cellar/python/2.7.2/lib/python2.7/site-packages'] 

Irgendeine Idee, was los ist

Update: Lösung gefunden

Standardmäßig wird die neueste Version 4.0B von BeautifulSoup installiert. Verwenden Sie stabile Versionen pip install BeautifulSoup==3.2.0, und Importieren usw. funktioniert.

3

2 Antworten auf die Frage

2
Chris Poole

Standardmäßig wird die neueste Version 4.0B von BeautifulSoup installiert. Verwenden Sie stabile Versionen pip install BeautifulSoup==3.2.0, und Importieren usw. funktioniert.

0
Bengt

BeautifulSoup wird nun in gespaltet beautifulsoup(Version 3 . ) Und beautifulsoup4(Version 4 . ) In Pip.

So installieren Sie eine bestimmte Version:

sudo pip install beautifulsoup # version 3 

oder

sudo pip install beautifulsoup4 # version 4