2013-06-25 3 views
0

하지 않습니다하지만 난 오류 Beautifulsoup is not a module 수 :BeautifulSoup로 내가 다음 코드를 실행하려고 모듈

나는 'BS4에서'시도했습니다
import urllib 
from Beautifulsoup import BeautifulSoup 
webpage = urlopen('http://en.wikipedia.org/wiki/Mathematics').read 

patfinderTitle = re.compile('<title>(.#)</title>') 

if __name__=='__main__': main() 

, easy_install을 사용 , 2.7 파이썬, BeautifulSoup로 3.2. 1, 어떻게해야합니까?

+2

- 당신이 대신'from bs4 import BeautifulSoup'을 사용하려고 했습니까? –

+0

BeautifulSoup을 설치했습니다. ie easy_install BeautifulSoup. 제대로 설치되었습니다. 이제 어떻게해야합니까? –

+0

@JonClements pypi 이름이'bs4'가 아닌'beautifulsoup4'이기 때문에 다소 혼란 스럽습니다. – SheetJS

답변

2

실제 모듈 이름은 (주 케이스) BeautifulSoup입니다 : BS4를 들어

$ sudo easy_install beautifulsoup 
$ python 
>>> from BeautifulSoup import BeautifulSoup 

: 당신은`bs4` 설치를 시도하고 성공적으로 설치 한 보았다 경우

$ sudo easy_install beautifulsoup4 
$ python 
>>> from bs4 import BeautifulSoup 
+0

안녕하세요, 마이크로 소프트를 사용하고 있습니다. 그러나 코드는별로 다르지 않습니다. 잘 나는 양쪽 다 시험해 보았고, 어느 쪽도 일하지 않았다. 저는 Win7에서 2.7을 사용하고 있습니다 –

+0

차이점은'S'입니다. 당신은'Beautifulsoup import BeautifulSoup'에서'BeautifulSoup importSuperSupp'을 작성해야합니다. 차이점을 확인 하시겠습니까? – SheetJS

관련 문제