2014-01-08 278 views
1

我正在尝试将美丽的Soup4-4.1.0导入到Python 3.3中(我已经放入了美丽的汤:C:\Python33\Lib\site-packages\BeautifulSoup\bs4)。尝试导入BeautifulSoup时出现异常

使用下列内容:

from BeautifulSoup import bs4 

我收到以下错误:

Traceback (most recent call last): 
    File "<pyshell#5>", line 1, in <module> 
    from BeautifulSoup import bs4 
    File "C:\Python33\lib\site-packages\BeautifulSoup\bs4\__init__.py", line 175 
    except Exception, e: 

任何人都可以在这方面帮助?

回答

1

我建议你阅读BeautifulSoup documentation因为我举:

Beautiful Soup 4 works on both Python 2 (2.6+) and Python 3.

在任何情况下BeautifulSoup 4通过PyPI将公布,因此,如果您不能与系统打包安装它,您可以安装它用easy_install或pip。包名是beautifulsoup4,及相同的封装工作在Python 2和Python 3的

$ easy_install beautifulsoup4 

$ pip install beautifulsoup4 

如果你没有的easy_install或PIP安装,你可以下载BeautifulSoup 4源码包,并通过setup.py安装。 [转到该文件夹​​并运行命令setup.py install(假设* .py在路径扩展中是已知的,否则运行

c:\pythonXX\python setup.py install). 
+0

非常感谢! – Prairy

相关问题