我有以下问题,我正在使用命令
pip install pyinstaller --proxy=http://webdefence.global.blackspider.com:80 --trusted-host=pypi.python.org
Run Code Online (Sandbox Code Playgroud)
我的问题是在安装过程中未维护代理变量。尝试安装setuptools时,它不再具有代理地址。我尝试使用HTTP_PROXY和HTTPS_PROXY在我的环境变量中没有运气。还有其他方法可以设置将通过pip安装维护的代理吗?
我曾使用-vvv产生更多错误详细信息-粘贴在 gist.github.com/blaggrob/19e7afcae2b4f1d36139fbf0a88a6651
Collecting pyinstaller
Using cached https://files.pythonhosted.org/packages/03/32/0e0de593f129bf1d1e77eed562496d154ef4460fd5cecfd78612ef39a0cc/PyInstaller-3.4.tar.gz
Installing build dependencies ... error
Complete output from command c:\users\blaggr\appdata\local\programs\python\python37-32\scripts\python.exe -m pip install --ignore-installed --no-user --prefix C:\Users\blaggr\AppData\Local\Temp\pip-build-env-vd3w15r1 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple --trusted-host pypi.python.org -- setuptools wheel:
Collecting setuptools
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/setuptools/
Could not find a version that satisfies the requirement setuptools (from versions: )
No matching distribution found for setuptools
Run Code Online (Sandbox Code Playgroud)
新的PEP 518支持实现可能会遇到一个错误,该错误中,为安装构建时依赖性而创建的隔离构建环境缺少必要的代理配置。
您可以通过--no-build-isolation在命令行上使用,no-build-isolation=no在配置文件中进行设置或通过设置PIP_NO_BUILD_ISOLATION=no环境变量来绕开新功能(是的,这最后两个选项是违反直觉的)。
这确实需要setuptools并wheels在安装之前已经安装pyinstaller。
我对该pip项目提出了新的问题,以跟踪这一情况,但我不相信它之前也没有报告过。
4 年后该错误仍然存在,但有一个合理的解决方法!感谢 Pypa 项目的 q0w,他发布了 @MartijnPieters 在他的答案中链接的问题。
\n设置环境变量PIP_PROXY而不是使用--proxy命令行参数。pip 子进程可以很好地找到并使用环境变量。pyproject.toml以下是 pip 22.3.1通过公司代理服务器安装带有文件及其依赖项的源 tarball 的示例:
% export PIP_PROXY=http://the.proxy.mybigcompany.com:8080\n% pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz \nCollecting https://files.pythonhosted.org/packages/a3/50/c4d2727b99052780aad92c7297465af5fe6eec2dbae490aa9763273ffdc1/pip-22.3.1.tar.gz\n Downloading pip-22.3.1.tar.gz (2.1 MB)\n \xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81\xe2\x94\x81 2.1/2.1 MB 851.7 kB/s eta 0:00:00\n Installing build dependencies ... done\n Getting requirements to build wheel ... done\n Preparing metadata (pyproject.toml) ... done\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
783 次 |
| 最近记录: |