python - pip安装openpyxl失败--如何克服proxy

标签 python proxy openpyxl

我正在尝试安装 python 库 openpyxl。我刚刚在我的 Windows 10 工作计算机上安装了 python 3.6。我的安装尝试的结果如下。

我发现了一个相关问题:pip install and custom index url

如果我的问题是使用代理,我能做些什么来安装 openpyxl 吗?

C:\Users\00168070>pip install openpyxl

Collecting openpyxl Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError>(': Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/openpyxl/

Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/openpyxl/

Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/openpyxl/

Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/openpyxl/

Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError(': Failed to establish a new connection: [Errno 11002] getaddrinfo failed',)': /simple/openpyxl/

Could not find a version that satisfies the requirement openpyxl (from versions: )

No matching distribution found for openpyxl

最佳答案

您的本地网络状态似乎无法解析主机名。也许你可以尝试从源代码安装它,下面是我的步骤:

1:下载源码:

https://pypi.python.org/pypi/openpyxl

2:构建并安装:

python3.6 setup.py install

3:输出:

.........
creating dist
creating 'dist/openpyxl-2.5.0-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing openpyxl-2.5.0-py3.6.egg
creating /usr/local/lib/python3.6/dist-packages/openpyxl-2.5.0-py3.6.egg
Extracting openpyxl-2.5.0-py3.6.egg to /usr/local/lib/python3.6/dist-packages
Adding openpyxl 2.5.0 to easy-install.pth file

Installed /usr/local/lib/python3.6/dist-packages/openpyxl-2.5.0-py3.6.egg
Processing dependencies for openpyxl==2.5.0
Searching for et-xmlfile==1.0.1
Best match: et-xmlfile 1.0.1
Adding et-xmlfile 1.0.1 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Searching for jdcal==1.3
Best match: jdcal 1.3
Adding jdcal 1.3 to easy-install.pth file

Using /usr/local/lib/python3.6/dist-packages
Finished processing dependencies for openpyxl==2.5.0

4:导入和使用:

Python 3.6.3 (default, Oct  6 2017, 08:44:35)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from openpyxl import Workbook
>>>

关于python - pip安装openpyxl失败--如何克服proxy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49105344/

相关文章:

python - 使用 Openpyxl 将特定列从一个工作簿复制到另一个工作簿

python - 更新元组中的列表

python - 仅将一张纸加载到数据框

python - 使用 openpyxl 模块写入电子表格会创建损坏的电子表格,如何使用 zipfile 模块修复?

java - 使用 Java 的 htmlunit.WebClient 和多个代理进行多线程处理

php - 使用 Curl 代理发布数据不返回任何内容

angular - 如何配置 nginx 以在/和代理/api 上为另一个 api 服务器提供 Angular 应用程序?

python - 用 BeautifulSoup 抓取表格,如何用换行符分隔元素?

python - Python 3 中的 re.findall

python - Pandas SQLalchemy : complex filter on database columns