今天在安装python的goose-extractor开发包时出现如下错误:
D:\Program Files (x86)\Python35-32\Scripts>pip install goose-extractor
Collecting goose-extractor
Using cached goose-extractor-1.0.25.tar.gz
Collecting Pillow (from goose-extractor)
Using cached Pillow-3.1.1-cp35-none-win32.whl
Collecting lxml (from goose-extractor)
Using cached lxml-3.6.0.tar.gz
Collecting cssselect (from goose-extractor)
Using cached cssselect-0.9.1.tar.gz
Collecting jieba (from goose-extractor)
Using cached jieba-0.38.zip
Collecting beautifulsoup (from goose-extractor)
Using cached BeautifulSoup-3.2.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\ADMINI~1\AppData\Local\Temp\pip-build-c1volnuc\beautifulsou
p\setup.py", line 22
print "Unit tests have failed!"
^
SyntaxError: Missing parentheses in call to 'print'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\ADMINI~1
\AppData\Local\Temp\pip-build-c1volnuc\beautifulsoup\
--------------------------------------------------------------------------------------------------------------------------------
错误原因:
1、我安装的python版本是python-3.5.1-x86.exe
2、goose-extractor-1.0.25依赖BeautifulSoup-3.2.1
3、 BeautifulSoup-3.2.1是用python2.X.X开发的
4、听说python3.X.X系列和python2.X.X系列不兼容?我刚用python,对此还不甚了解,现在发现print不兼容。。。
-------------------------------------------------------------------------------------------------------------------------------------------------------------
解决方法:
1、安装python的版本选择python-2.7.11版本即可。
https://www.python.org/downloads/release/python-2711/
------------------------------------------------------------------------------------------------------------------------------------------------------------------
我安装成功时的信息如下:
...
Installing collected packages: Pillow, lxml, cssselect, jieba, beautifulsoup, nl
tk, goose-extractor
Running setup.py install for cssselect
Running setup.py install for jieba
Running setup.py install for beautifulsoup
Running setup.py install for nltk
Running setup.py install for goose-extractor
Successfully installed Pillow-3.1.1 beautifulsoup-3.2.1 cssselect-0.9.1 goose-extractor-1.0.25 jieba-0.38 lxml-3.6.0 nltk-3.2