2015-06-04 74 views
0

我正在嘗試安裝newspaper3k。 我做相應一切以installation guide通過點安裝newspaper3k包的錯誤

sudo apt-get install python-dev

sudo apt-get install libxml2-dev libxslt-dev

sudo apt-get install libjpeg-dev zlib1g-dev libpng12-dev

pip3 install newspaper

在運行pip install newspaper我越來越:

Traceback (most recent call last): 

    File "<string>", line 17, in <module> 

    File "/tmp/pip_build_ovd/nltk/setup.py", line 23, in <module> 

    distribute_setup.use_setuptools() 

    File "/tmp/pip_build_ovd/nltk/distribute_setup.py", line 145, in use_setuptools 

    return _do_download(version, download_base, to_dir, download_delay) 

    File "/tmp/pip_build_ovd/nltk/distribute_setup.py", line 125, in _do_download 

    _build_egg(egg, tarball, to_dir) 

    File "/tmp/pip_build_ovd/nltk/distribute_setup.py", line 116, in _build_egg 

    raise IOError('Could not build the egg.') 

OSError: Could not build the egg. 

---------------------------------------- 
Cleaning up... 
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_ovd/nltk 

我從來沒有遇到這種類型的錯誤。有什麼方法可以解決這個問題,我做錯了什麼?

回答

0

從github安裝幫助我。

pip3 install git+https://github.com/codelucas/newspaper.git

0

你安裝了錯誤的包。它實際上是:

pip3 install newspaper3k

0

一些澄清:

pip3 install newspaper3k 

pip3 install git+https://github.com/codelucas/newspaper.git 

都爲Python 3.如果你想在Python的2.7版本,你可以使用

pip install newspaper 

但是我不斷收到OP描述的問題。問題是Python 2.7版本明確列出了所需庫的版本號。爲了解決這個問題下載該文件從

https://pypi.python.org/packages/source/n/newspaper/newspaper-0.0.9.8.tar.gz#md5=331375b5a941e038a73827ea014d4c21

將它解壓縮到一個文件夾。然後打開requirements.txt文件並將所有==更改爲>=。這將允許您使用最新版本的依賴關係。您也可以選擇僅針對您遇到問題的依賴項進行更改,然後pip將卸載當前版本並安裝舊版本。然而,如果報紙結束了新版本的錯誤,這可能會解決它。

0

我認爲pypi「報紙」是python2分支。試試:pip install newspaper3k