昨天装虚拟环境一直报错
(autohome_spider) liang@liang-virtual-machine:~/.spider$ mkvirtualenv -p /usr/bin/python3 mygerapyAlready using interpreter /usr/bin/python3Using base prefix '/usr'New python executable in /home/liang/.spider/mygerapy/bin/python3Not overwriting existing python script /home/liang/.spider/mygerapy/bin/python (you must use /home/liang/.spider/mygerapy/bin/python3)Installing setuptools, pkg_resources, pip, wheel... Complete output from command /home/liang/.spider/mygerapy/bin/python3 - setuptools pkg_resources pip wheel: Collecting setuptoolsException:Traceback (most recent call last): File "/home/liang/.spider/mygerapy/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 377, in _make_request httplib_response = conn.getresponse(buffering=True)TypeError: getresponse() got an unexpected keyword argument 'buffering'During handling of the above exception, another exception occurred:Traceback (most recent call last): File "/home/liang/.spider/mygerapy/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 560, in urlopen body=body, headers=headers) File "/home/liang/.spider/mygerapy/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 379, in _make_request httplib_response = conn.getresponse() File "/usr/lib/python3.5/http/client.py", line 1197, in getresponse response.begin() File "/usr/lib/python3.5/http/client.py", line 297, in begin version, status, reason = self._read_status() File "/usr/lib/python3.5/http/client.py", line 266, in _read_status raise RemoteDisconnected("Remote end closed connection without"http.client.RemoteDisconnected: Remote end closed connection without responseDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/commands/install.py", line 328, in run wb.build(autobuilding=True) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/wheel.py", line 748, in build self.requirement_set.prepare_files(self.finder) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/req/req_set.py", line 577, in _prepare_file session=self.session, hashes=hashes) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/download.py", line 810, in unpack_url hashes=hashes File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/download.py", line 649, in unpack_http_url hashes) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/download.py", line 842, in _download_http_url stream=True, File "/home/liang/.spider/mygerapy/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get return self.request('GET', url, **kwargs) File "/usr/share/python-wheels/pip-8.1.1-py2.py3-none-any.whl/pip/download.py", line 378, in request return super(PipSession, self).request(method, url, *args, **kwargs) File "/home/liang/.spider/mygerapy/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request resp = self.send(prep, **send_kwargs) File "/home/liang/.spider/mygerapy/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send r = adapter.send(request, **kwargs) File "/home/liang/.spider/mygerapy/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send timeout=timeout File "/home/liang/.spider/mygerapy/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen _stacktrace=sys.exc_info()[2]) File "/home/liang/.spider/mygerapy/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment total -= 1TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'----------------------------------------...Installing setuptools, pkg_resources, pip, wheel...done.Traceback (most recent call last): File "/usr/bin/virtualenv", line 9, in load_entry_point('virtualenv==15.0.1', 'console_scripts', 'virtualenv')()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 988, in create_environment
download=download,
File "/usr/lib/python3/dist-packages/virtualenv.py", line 918, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 812, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/liang/.spider/mygerapy/bin/python3 - setuptools pkg_resources pip wheel failed with error code 2
各种查找解决方案,最终也没解决。晚上就想之前操作过什么东西,就想起改过pip源,设成了永久的
pip源的改法 https://www.jianshu.com/p/3621780417be
今天早上把原先建的pip.conf文件删了,再去装虚拟环境,OK了。