安装 python 虚拟环境 > pip install virtualenv -i https://pypi.tuna./simple/报错解决办法
[root@ch02 pip-19.1]# pip install virtualenv -i https://pypi.tuna./simple/Looking in indexes: https://pypi.tuna./simple/Collecting virtualenvDownloading https://pypi.tuna./packages/9f/fb/7423637e48cffbb2e567ca113d2b05068f8b457dde998ab487adf7386c86/virtualenv-20.4.2-py2.py3-none-any.whl (7.2MB)|████▏ | 942kB 75kB/s eta 0:01:23ERROR: Exception:Traceback (most recent call last):File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_vendor/urllib3/response.py", line 360, in _error_catcheryieldFile "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_vendor/urllib3/response.py", line 442, in readdata = self._fp.read(amt)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_vendor/cachecontrol/filewrapper.py", line 62, in readdata = self.__fp.read(amt)File "/usr/local/python3/lib/python3.7/http/client.py", line 447, in readn = self.readinto(b)File "/usr/local/python3/lib/python3.7/http/client.py", line 491, in readinton = self.fp.readinto(b)File "/usr/local/python3/lib/python3.7/socket.py", line 589, in readintoreturn self._sock.recv_into(b)File "/usr/local/python3/lib/python3.7/ssl.py", line 1052, in recv_intoreturn self.read(nbytes, buffer)File "/usr/local/python3/lib/python3.7/ssl.py", line 911, in readreturn self._sslobj.read(len, buffer)socket.timeout: The read operation timed outDuring handling of the above exception, another exception occurred:Traceback (most recent call last):File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/cli/base_command.py", line 178, in mainstatus = self.run(options, args)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/commands/install.py", line 352, in runresolver.resolve(requirement_set)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/resolve.py", line 131, in resolveself._resolve_one(requirement_set, req)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/resolve.py", line 294, in _resolve_oneabstract_dist = self._get_abstract_dist_for(req_to_install)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/resolve.py", line 242, in _get_abstract_dist_forself.require_hashesFile "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/operations/prepare.py", line 353, in prepare_linked_requirementprogress_bar=self.progress_barFile "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/download.py", line 886, in unpack_urlprogress_bar=progress_barFile "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/download.py", line 746, in unpack_http_urlprogress_bar)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/download.py", line 954, in _download_http_url_download_url(resp, link, content_file, hashes, progress_bar)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/download.py", line 683, in _download_urlhashes.check_against_chunks(downloaded_chunks)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/utils/hashes.py", line 62, in check_against_chunksfor chunk in chunks:File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/download.py", line 651, in written_chunksfor chunk in chunks:File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/utils/ui.py", line 156, in iterfor x in it:File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_internal/download.py", line 640, in resp_readdecode_content=False):File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_vendor/urllib3/response.py", line 494, in streamdata = self.read(amt=amt, decode_content=decode_content)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_vendor/urllib3/response.py", line 459, in readraise IncompleteRead(self._fp_bytes_read, self.length_remaining)File "/usr/local/python3/lib/python3.7/contextlib.py", line 130, in __exit__self.gen.throw(type, value, traceback)File "/usr/local/python3/lib/python3.7/site-packages/pip-19.1-py3.7.egg/pip/_vendor/urllib3/response.py", line 365, in _error_catcherraise ReadTimeoutError(self._pool, None, 'Read timed out.')pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.tuna.', port=443): Read timed out.
下载失败:
1.直接将网站复制到浏览器上下载:
https://pypi.tuna./packages/9f/fb/7423637e48cffbb2e567ca113d2b05068f8b457dde998ab487adf7386c86/virtualenv-20.4.2-py2.py3-none-any.whl
2.再将此文件上传至虚拟机:
3.进入virtualenv-20.4.2-py2.py3-none-any.whl目标文件夹:
4.执行下面的命令
[root@ch02 software]# pip install virtualenv-20.4.2-py2.py3-none-any.whl
显示 虚拟环境 安装成功: