Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
安装python新闻包时出现的问题_Python_Pycharm_Nltk_Python Newspaper - Fatal编程技术网

安装python新闻包时出现的问题

安装python新闻包时出现的问题,python,pycharm,nltk,python-newspaper,Python,Pycharm,Nltk,Python Newspaper,我正在虚拟环境中使用以下命令安装Python报纸库: pip install newspaper 我得到以下错误。在我尝试了StackOverflow的一些解决方案后,它仍然存在,但没有起作用我也遇到过同样的问题,在此之前,我通过安装特定版本(和更新)的安装工具(不同的机器)解决了这个问题。但是,它在这里不起作用 知道我做错了什么吗?这个错误实际上意味着什么 IDE:Pycharm与虚拟环境,Ubuntu上的Python 2.7 错误: File "/tmp/tmp4L5_rz/distrib

我正在虚拟环境中使用以下命令安装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/
文件“/tmp/tmp4L5_rz/distribute-0.6.21/pkg_resources.py”,第2229行,在激活中
self.insert_on(路径)
文件“/tmp/tmp4L5_rz/distribute-0.6.21/pkg_resources.py”,第2330行,插入
使用distribute。在%s“%str(self.location))
ValueError:0.7系列setuptools不能与distribute一起安装。在/usr/lib/python2.7/dist-packages找到一个
/tmp/pip-build-LTk2i0/nltk/distribute-0.6.21-py2.7.egg
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/tmp/pip-build-LTk2i0/nltk/setup.py”,第23行,在
分发设置。使用设置工具()
文件“/tmp/pip-build-LTk2i0/nltk/distribute_setup.py”,第145行,正在使用的设置工具
返回下载(版本、下载库、到目录、下载延迟)
文件“/tmp/pip-build-LTk2i0/nltk/distribution\u setup.py”,第125行,下载
_造蛋(蛋、柏油球、去方向)
文件“/tmp/pip-build-LTk2i0/nltk/distribution\u setup.py”,第116行,在“build\u egg”中
raise IOError('无法生成鸡蛋')
IOError:无法生成鸡蛋。
----------------------------------------
命令“python setup.py egg_info”失败,错误代码为/tmp/pip-build-LTk2i0/nltk中的1/

尝试重新安装安装工具

pip install --upgrade setuptools
如果不起作用,请删除或分发:

rm -fr /usr/local/lib/python2.7/dist-packages/distribute*
可以证实这一点

pip安装--升级安装工具

pip install --upgrade setuptools

清除了ec2上的安装问题根据报纸的Github文档页面,他们已经弃用了Python 2版本的API,并将其称为bug。确切声明如下:

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

这表明我们不应该再使用Python2版本了


现在,对于这个特定的用例,我切换到了Python3

你使用Linux还是Windows?就连我今天在安装报纸时也遇到了同样的问题。然而,按照Flavio的建议升级setuptools帮助我解决了这个问题,但随后又遇到了另一个问题,即“lxml/includes/etree_defs.h:9:31:致命错误:libxml/xmlversion.h:没有这样的文件或目录”,但通过安装这些软件包(apt get install libxml2 dev libxslt-dev)就解决了这个问题。甚至我也在Ubuntu 16.04上。您是否遇到了其他错误,或者仍然停留在第一个错误上?请尝试:apt get install libxmlsec1-dev@FlavioMilan我试过了。事实上,我尝试了网上提供的解决方案。我也正确地遵循了报纸的安装,但它没有帮助。我怀疑我的安装工具版本有问题,但我能解决。这些都不起作用。我之前尝试过一个特定版本的安装工具来解决这个问题。但那是很久以前的事了,所以我不记得了。