python - 错误“找不到满足烧瓶要求的版本(来自版本:)找不到烧瓶的匹配分布”
问题描述
使用 pip 安装包时出现异常。我尝试安装NumPy、Flask等,但出现以下错误。
pip install flask
Collecting flask
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0667CB50>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/flask/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0667C190>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/flask/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0667C7F0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/flask/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0667C8F0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/flask/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x0667C0F0>: Failed to establish a new connection: [Errno 11002] getaddrinfo failed')': /simple/flask/
Could not find a version that satisfies the requirement flask (from versions: )
No matching distribution found for flask
我该如何解决?
pip 版本是 18.1,Python 版本是 3.7。
解决方案
好的,这是我一直遵循的 hack,但它每次都有效 - 我需要这样做,因为我的公司网络落后于沉重的分层安全性。
每次您需要安装 pip 包时,请事先从您的 cmd 运行以下命令(您不需要是管理员):
set http_proxy=http://your_corp_username:password@<your_corp_proxy_host>:<port>
set https_proxy=https://your_corp_username:password@<your_corp_proxy_host>:<port>
然后运行你常用的 pip 命令。
如果 pip 抛出一些 SSL 信任/解析错误,您还可以执行以下操作以通过您的网络信任 pip:
pip --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org install <some_package>
仅在当前用户下使用以下内容安装软件包(这不需要管理员权限)
pip --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org install <some_package> --user
推荐阅读
- heroku - 未在本地环境中运行时,Smtp 邮件失败
- python - 无法配置问题出在哪里:未定义“urllib”
- java - 为什么我的切入点内的 Spring AOP 不起作用但执行是?
- javascript - Typescript + react 17 + webpack 5. 使用 react HashRouter 进行代码拆分不起作用
- llvm - 如何以足够通用的方式解析 LLVM GEP 指令?
- java - 是否可以在 python 环境中运行的 AWS Lambda 函数中执行 java 代码?
- javascript - 使用 HTML/Javascript 中的下拉菜单显示列表
- github - 如何将我的 git 默认目录更改为 main
- http - 为 URL 的所有子目录提供默认页面
- javascript - IE11 兼容 Object.fromEntries