0

我对 Python 没有太多经验,需要一些帮助。我正在尝试安装不同的软件包但没有成功。最近我尝试使用安装 tabula-pypip install tabula-py但我一直得到相同的响应。

如何解决这个问题?

Collecting tabula-py
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000026AEB39CDC8>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tabula-py/
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000026AEB3B0888>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tabula-py/
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000026AEB3BF088>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tabula-py/
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000026AEB3BF888>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tabula-py/
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0000026AEB3BF6C8>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/tabula-py/
  ERROR: Could not find a version that satisfies the requirement tabula-py (from versions: none)
ERROR: No matching distribution found for tabula-py
4

1 回答 1

0

错误是因为 pip 无法连接到 pypi.org 服务器并下载必要的包并安装它。

首先,尝试检查是否可以连接到 pypi.org(从 cmd 或 shell):

ping pypi.org

如果您通过常规 shell 建立连接,python3 中的 Internet 设置可能有问题。您可以检查是否可以通过此脚本进行连接:

import urllib.request


with urllib.request.urlopen('http://pypi.org/') as response:
    status = response.status
    if 500 > status >= 400:
        print("Connection Error from Client: " + str(status))
    elif 600 > status >= 500:
        print("Connection Error from Server: " + str(status))
    else:
        print("Connection Successful")

如果有连接问题,可以考虑下载一个wheel文件tabula-py并安装到本地:

pip install /path/to/tabula_py-1.4.2-py3-none-any.whl

在这种情况下No matching distribution found...:仔细检查您的 python 版本。在某些机器上,您可能会发现不止一个版本的 python,有时由 3rd 方软件(即 Microsoft Visual Studio)安装。使用以下命令检查您的 pip 版本:

pip -V

于 2019-12-03T13:44:17.103 回答