首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >安装python报纸包的问题

安装python报纸包的问题
EN

Stack Overflow用户
提问于 2017-07-17 11:28:59
回答 3查看 1.2K关注 0票数 1

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

代码语言:javascript
运行
复制
pip install newspaper

我得到以下错误。在我尝试了一些来自StackOverflow的解决方案之后,它仍然存在,但是它没有起作用。在之前,我也遇到了同样的问题,在安装特定版本(并更新)安装工具(不同的机器)时,我解决了这个问题。但是,在这里不起作用。

知道我做错什么了吗?这个错误实际上意味着什么?

IDE: Pycharm与虚拟环境,Python2.7onUbuntu

错误:

代码语言:javascript
运行
复制
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/
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2017-09-28 11:57:18

根据报纸的Github文档页面,他们反对使用Python2版本的API,并将其命名为buggy。具体说明如下:

代码语言:javascript
运行
复制
"Newspaper is a Python3 library! Or, view our deprecated and buggy Python2 branch"

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

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

现在,对于这个特定的用例,我切换到Python 3。

票数 1
EN

Stack Overflow用户

发布于 2017-07-17 11:33:37

尝试重新安装setuptools

代码语言:javascript
运行
复制
pip install --upgrade setuptools

如果不工作,请删除分发:

代码语言:javascript
运行
复制
rm -fr /usr/local/lib/python2.7/dist-packages/distribute*
票数 0
EN

Stack Overflow用户

发布于 2017-07-30 15:39:02

可以证实这一点

pip安装--升级setuptools

清除ec2上的安装问题

票数 -2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45143097

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档