Python 3.x Pip can';不要安装任何软件包

Python 3.x Pip can';不要安装任何软件包,python-3.x,pip,Python 3.x,Pip,您好大约两周前,我开始无法下载python软件包,甚至无法访问pypi网站,这在chrome和firefox上是“无法访问”的 当我尝试下载软件包时,它会告诉我: $ python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose Collecting numpy Retrying (Retry(total=4, connect=None, read=None, redirect=No

您好大约两周前,我开始无法下载python软件包,甚至无法访问pypi网站,这在chrome和firefox上是“无法访问”的

当我尝试下载软件包时,它会告诉我:

$ python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose
Collecting numpy
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))': /simple/numpy/
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
我不知道为什么会这样,我没有在我的电脑上做任何改变,只是有一天它开始这样做,在我的两台电脑上,我不明白。 有人知道为什么会这样吗?我搜索了几个小时,但找不到任何可以更正此错误的内容

我所尝试的: -卸载所有python程序并重新安装 -检查我的司机(你永远不知道) -停用任何代理 -禁用我的防火墙


操作系统:Windows 10

因此,对于任何正在搜索解决方案的人,我发现这可能不是最优的,但至少它可以工作,使用此命令代替pip安装包

python.exe-m pip安装包--proxy=“proxy:port”

你可以在这里找到一个免费代理的大列表:(注意,并不是所有代理都能工作,在得到一个有效的代理之前,你可能需要尝试多个代理)

例如,您可以使用: python.exe-m pip install numpy--proxy=“179.185.199.195:8080”

这就行了,
Shraneid

使用上一个答案中的代理将暂时使事情正常运行-如果您发现一个代理没有超时,但它不能解决问题,并且在大多数情况下,使用代理将阻碍您的下载速度

我发现,您需要调查Python解释器的位置,确保venv没有引起问题

例如,如果setuptools不更新,那么很可能您的代码或项目中已经有一部分在持续使用setuptools,禁止其更新,其他软件包需要安装新版本的setuptools

由于某种原因,这会导致大多数软件包(如tensorflow、keras、pandas等)出现“ConnectionResetError:现有连接被远程主机强制关闭”

在另一个空位置重新创建venv将重置所有包

要在Pycharm中执行此操作,请执行以下操作:

File -> Settings
Project: -> Project Interpreter
Project Interpreter -> drop down list -> show all

Remove your current Python Interpreter location
Add New Environment
然后,您将被要求为您的项目放置一个位置: 在此处使用新位置将解决包安装的[Win10054]ConnectionReset错误

基本解释器:指向python.exe位置 (默认值通常为:C:\Users\UserProfile\AppData\Local\Programs\Python\PythonXX\Python.exe 并将XX替换为当前版本,将UserProfile替换为您的配置文件)

最重要的是: 因为您已经安装了一个新位置,所以请先安装setuptools,如果已经安装了,请先升级。
之后,您可以将代码迁移到新的venv,并且所有新软件包都应在没有任何connectionResetErrors的情况下工作。

pip 20.3似乎存在问题: 我已经降到了20.2.4,这对我很有效


(我知道这不可能是原始问题的原因,但我认为当前遇到此问题的人也会访问此页面)

您使用的是什么操作系统?抱歉,忘记了,刚刚编辑为什么使用python-m pip安装,而不是直接使用pip?在windows操作系统上安装python时,应该有安装额外软件包的选项。选择该选项,同时选择类似“导出环境变量”的选项。最后,您应该能够简单地在cmd上运行“pip install some_lib”。尝试一下,看看会发生什么。它不会改变我通常使用pip安装的任何东西,但我使用了它,因为这是他们说要在numpy网站上使用的命令,它给出了相同的错误