2013-07-17 1 views
1

배경을 사용하여 2.7 설치된 & 내가 무슨 짓을 : 나는 웹 페이지 콘텐츠 추출기를 작성, 그리고 더 나은 구문 분석에 BeautifulSoup4를 설치할 필요가 실현 해요 내 HTML 파일. 내 Ubuntu 13.04 시스템에는 Python2.7 (시스템 기본값)과 Python3.3.1이 모두 설치되어 있습니다. "SSL 인증서"문제로 인해 pipeasy_install 몇 가지 오류가 발생하면 마지막 시도에서 easy_install을 사용하여 BeautifulSoup4를 설치해야합니다.파이썬 실패 파이썬에서 Python3.3.1에 BeautifulSoup4을 가져올 수 있지만, 성공하는 easy_install을

그러나 :

Searching for beautifulsoup4 
Reading http://pypi.python.org/simple/beautifulsoup4/ 
Best match: beautifulsoup4 4.2.1 
Downloading https://pypi.python.org/packages/source/b/beautifulsoup4/beautifulsoup4-4.2.1.tar.gz#md5=91ea70ce16a5f1f43e58f2ef05651679 
Processing beautifulsoup4-4.2.1.tar.gz 
Writing /tmp/easy_install-OLXNjV/beautifulsoup4-4.2.1/setup.cfg 
Running beautifulsoup4-4.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-OLXNjV/beautifulsoup4-4.2.1/egg-dist-tmp-SpupH8 
zip_safe flag not set; analyzing archive contents... 
Adding beautifulsoup4 4.2.1 to easy-install.pth file 

Installed /usr/local/lib/python2.7/dist-packages/beautifulsoup4-4.2.1-py2.7.egg 

이 지금 내가 할 수 있어요 : 내 시스템에서 Python2.7 디렉토리 (/usr/local/lib/python2.7/dist-packages)에 easy_install 설치 BS4, 당신은 아래 정보에서 말할 수있는 것 같다 이 오류 메시지와 Python3.3에서 수입 Python2.7에서 BS4 있지만, :

>>> import bs4 
Traceback (most recent call last): 
    File "<pyshell#8>", line 1, in <module> 
    import bs4 
ImportError: No module named 'bs4' 

질문 : 내가이 Python2.7 디렉토리를 추가해야 내 Python3.3 라이브러리 디렉토리? (나는이 공유 라이브러리 경로로 인해 같은 모듈의 서로 다른 버전의 미래 충돌에 대해 걱정한다.) 아니면 BS4를 제거하고 pip으로 다시 시도해야합니까? 그러면 BS4를 Python3.3 디렉토리에 설치하겠습니까? (지금은 pip : Requirement already satisfied (use --upgrade to upgrade): beautifulsoup4 in ./beautifulsoup4-4.2.1-py2.7.egg을 사용하여 BS4를 다시 설치하려고 시도했을 때 반환되었습니다.)이 문제를 해결하는 방법에 대한 일반적인 참고 자료도 제공됩니다. 고맙습니다!

답변

1

섹션 Download Beautiful Soupofficial homepage에 따르면 python-beautifulsoup4 패키지를 Ubuntu 13.04에 설치할 수 있습니다.

파이썬 2.7과 3.3 사이의 충돌을 막기 위해 이것을 시도하십시오. 당신이 그것을하기 전에 잠재적 인 버전 충돌을 피하기 위해 아름다운 수프 달걀을 제거하는 것이 좋습니다거야.

관련 문제