python 创建虚拟环境时报错OSError, setuptools下载失败

在尝试创建Python虚拟环境时遇到OSError,问题源于setuptools模块下载缓慢导致的网络问题。尝试了升级pip、更改路径等方法无效。最终通过使用virtualenv创建无setuptools的环境,然后在环境中手动安装setuptools成功解决。此方法解决了创建虚拟环境的问题,后续创建其他环境也未再出现错误。参考了多篇博客找到解决方案。
摘要由CSDN通过智能技术生成

以前虚拟环境一下子就装好了, 今天多次尝试,发现错误信息总是如下

D:\vir_env\supetset>virtualenv env
Using base prefix 'c:\\python36'
New python executable in D:\vir_env\supetset\env\Scripts\python3.exe
Also creating executable in D:\vir_env\supetset\env\Scripts\python.exe
Installing setuptools, pip, wheel...

  Complete output from command D:\vir_env\supetset\env\Scripts\python3.exe - set
uptools pip wheel:
  Looking in links: c:\python36\lib\site-packages\virtualenv_support
Collecting setuptools
  Downloading https://files.pythonhosted.org/packages/a0/df/635cdb901ee4a8a42ec6
8e480c49f85f4c59e8816effbf57d9e6ee8b3588/setuptools-46.1.3-py3-none-any.whl (582
kB)
Exception:
Traceback (most recent call last):
  File "c:\python36\lib\site-packages\virtualenv_support\pip-19.0.3-py2.py3-none
-any.whl\pip\_vendor\urllib3\response.py", line 360, in _error_catcher
    yield
  File "c:\python36\lib\site-packages\virtualenv_support\pip-19.0.3-py2.py3-none
-any.whl\pip\_vendor\urllib3\response.py", line 442, in read
    data = self._fp.read(amt)
  File "c:\python36\lib\site-packages\virtualenv_support\pip-19.0.3-py2.py3-none
-any.whl\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "c:\python36\Lib\http\client.py", line 449, in read
    n = self.readinto(b)
  File "c:\python36\Lib\http\client.py", line 493, in readinto
    n = self.fp.readinto(b)
  File "c:\python36\Lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "c:\python36\Lib\ssl.py", line 1009, in recv_into
    return self.read(nbytes, buffer)
  File "c:\python36\Lib\ssl.py", line 871, in read
    return self._sslobj.read(len, buffer)
  File "c:\python36\Lib\ssl.py", line 631, in read
    v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python36\lib\site-packages\virtualenv_support\pip-19.0.3-py2.py3-none
-any.whl\pip\_internal\cli\base_command.py", line 179, in main
    status = self.run(options, args)
  File "c:\python36\lib\site-packages\virtualenv_support\pip-19.0.3-py2.py3-none
-any.whl\pip\_internal\commands\install.py", line 315, in run
    resolver.resolve(requirement_set)
  File "c:\python36\lib\site-packages\virtualenv_support\pip-19.0.3-py2.py3-none
-any.whl\pip\_internal\resolve.py", line 131
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值