无法使用pip安装openpyxl - 如何克服代理

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了无法使用pip安装openpyxl - 如何克服代理相关的知识,希望对你有一定的参考价值。

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

我找到了一个相关的问题:pip install and custom index url

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

C: Users 00168070> pip install openpyxl

收集openpyxl重试(重试(总计= 4,连接=无,读取=无,重定向=无))连接被'NewConnectionError>打破后(':无法建立新连接:[Errno 11002] getaddrinfo failed',)' :/ simple / openpyxl /

连接被'NewConnectionError(':无法建立新连接:[Errno 11002] getaddrinfo failed',')'/ simple后重试(重试(total = 3,connect = None,read = None,redirect = None)) / openpyxl /

连接被'NewConnectionError(':无法建立新连接:[Errno 11002] getaddrinfo failed',')'/ simple后重试(重试(total = 2,connect = None,read = None,redirect = None)) / openpyxl /

连接被'NewConnectionError(':无法建立新连接:[Errno 11002] getaddrinfo failed',')'/ simple后重试(重试(total = 1,connect = None,read = None,redirect = None)) / openpyxl /

连接被'NewConnectionError(':无法建立新连接:[Errno 11002] getaddrinfo failed',')'/ simple后重试(重试(total = 0,connect = None,read = None,redirect = None)) / openpyxl /

找不到满足openpyxl要求的版本(来自版本:)

找不到匹配的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
>>>

以上是关于无法使用pip安装openpyxl - 如何克服代理的主要内容,如果未能解决你的问题,请参考以下文章

安装python -m pip install openpyxl 类库报错,A new release of pip available

安装第三方库openpyxl时,报错:You are using pip version 19.0.3, however version 20.2b1 is available. You should

Win-Python3.7使用pip安装失败-用源码安装解决了

[随笔]openpyxl的安装

openpyxl的使用

python3操作Excel openpyxl模块的使用