I am trying to install newspaper3k
. I am doing all accordingly to the installation guide
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
While running pip install newspaper
I am getting:
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
I have never faced with errors of this type. What is the way to fix it and what am I doing wrong?
从github安装对我有帮助。
pip3 install git+https://github.com/codelucas/newspaper.git
You're installing the wrong package. It's actually:
pip3 install newspaper3k
Some clarification:
pip3 install newspaper3k
and
pip3 install git+https://github.com/codelucas/newspaper.git
are both for Python 3. If you want the Python 2.7 version you can use
pip install newspaper
However I kept getting the problem described by the OP. The problem is that the Python 2.7 version explicitly lists the version numbers of the required libraries. To fix this download the file from
Unzip it into a folder. Then open the requirements.txt file and change all the ==
to >=
. This will allow you to use the latest version of dependencies. Optionally you can only change this for the dependencies you're having a problem with, but then pip will uninstall your current versions and install the older versions. However, if newspaper ends up with errors with the new versions this might fix it.
I think that on pypi "newspaper" is the python2 branch. Try: pip install newspaper3k
我正在使用Anaconda,对我有用的方法是
conda install -c conda-forge newspaper3k
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.