簡體   English   中英

安裝python報紙包的問題

[英]issue with installing python newspaper package

我在虛擬環境中使用以下命令安裝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/

根據報紙的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。

嘗試重新安裝setuptools

pip install --upgrade setuptools

如果不起作用,請刪除分發:

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

可以確認

pip install --upgrade setuptools

解決了ec2上的安裝問題

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM