安装python报纸包的问题

时间:2017-07-17 11:28:59

标签: python pycharm nltk python-newspaper

我在虚拟环境中使用以下命令安装Python报表库:

pip install newspaper

我收到以下错误。在我尝试使用StackOverflow的一些解决方案之后它仍然存在,但它不起作用。 我遇到了同样的问题,之前我决定安装特定版本(和更新)的设置工具(不同的机器)。 但是,它在这里不起作用。

任何想法我做错了什么?这个错误究竟意味着什么?

IDE:具有虚拟环境的Pycharm,Ubuntu上的Python 2.7

错误:

File "/tmp/tmp4L5_rz/distribute-0.6.21/pkg_resources.py", line 2229, in activate
        self.insert_on(path)
      File "/tmp/tmp4L5_rz/distribute-0.6.21/pkg_resources.py", line 2330, in insert_on
        "with distribute. Found one at %s" % str(self.location))
    ValueError: A 0.7-series setuptools cannot be installed with distribute. Found one at /usr/lib/python2.7/dist-packages
    /tmp/pip-build-LTk2i0/nltk/distribute-0.6.21-py2.7.egg
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-LTk2i0/nltk/setup.py", line 23, in <module>
        distribute_setup.use_setuptools()
      File "/tmp/pip-build-LTk2i0/nltk/distribute_setup.py", line 145, in use_setuptools
        return _do_download(version, download_base, to_dir, download_delay)
      File "/tmp/pip-build-LTk2i0/nltk/distribute_setup.py", line 125, in _do_download
        _build_egg(egg, tarball, to_dir)
      File "/tmp/pip-build-LTk2i0/nltk/distribute_setup.py", line 116, in _build_egg
        raise IOError('Could not build the egg.')
    IOError: Could not build the egg.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-LTk2i0/nltk/

3 个答案:

答案 0 :(得分:1)

根据报纸的Github文档页面,他们已经弃用了API的Python 2版本并将其称为错误。确切陈述如下:

"Newspaper is a Python3 library! Or, view our deprecated and buggy Python2 branch"

参考:https://github.com/codelucas/newspaper

它表明我们不应再使用Python 2版本了。

目前,我已针对此特定用例切换到Python 3。

答案 1 :(得分:0)

尝试重新安装setuptools

pip install --upgrade setuptools

如果不起作用,请删除分发:

rm -fr /usr/local/lib/python2.7/dist-packages/distribute*

答案 2 :(得分:-2)

可以确认这个

pip install --upgrade setuptools

清除了ec2上的安装问题