親測有效:Virtualenv創建虛擬環境時報錯,“C:\\Users\\username\\AppData\\Local\\Temp\\pip-req-tracker-_f9ugn89”

背景:多次刪除創建失敗的虛擬環境,然後創建新的虛擬環境

之前創建失敗的操作: 通過在預安裝時取消默認的setuptools的安裝,之後通過pip進行安裝;

取消默認的setuptools安裝
virtualenv myenv --no-setuptools
安裝setuptools
pip install setuptools -i https://pypi.douban.com/simple

但是在第一步操作中仍然創建失敗,查看下方的錯誤信息,是因爲產生的臨時文件導致的問題。因此到下列文件夾中刪除當天產生的臨時文件。

重新執行命令創建新的虛擬環境即可。 

 錯誤信息如下:

  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
Cleaning up...
Removed build tracker 'C:\\Users\\username\\AppData\\Local\\Temp\\pip-req-tracker-_f9ugn89'
ERROR: Exception:
Traceback (most recent call last):
  File "f:\python37\lib\site-packages\virtualenv_support\pip-19.3.1-py2.py3-none-any.whl\pip\_vendor\urllib3\response.py", line 425, in _error_catcher
    yield
  File "f:\python37\lib\site-packages\virtualenv_support\pip-19.3.1-py2.py3-none-any.whl\pip\_vendor\urllib3\response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "f:\python37\lib\site-packages\virtualenv_support\pip-19.3.1-py2.py3-none-any.whl\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "f:\python37\Lib\http\client.py", line 447, in read
    n = self.readinto(b)
  File "f:\python37\Lib\http\client.py", line 491, in readinto
    n = self.fp.readinto(b)
  File "f:\python37\Lib\socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "f:\python37\Lib\ssl.py", line 1052, in recv_into
    return self.read(nbytes, buffer)
  File "f:\python37\Lib\ssl.py", line 911, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章