我陷入了virtualenv的问题,希望有人可以提供帮助。
尝试创建虚拟环境时出现此错误:OSError:命令/Users/andy.smith/foo/bar/bin/python2.7-setuptools pip wheel失败,错误代码2
我尝试清理Python环境并重新安装python和virtualenv, 并尝试了类似问题的解决方法,但无济于事。任何帮助都是非常欢迎的。
完整错误是:
$ mkdir foo
$ cd foo
$ virtualenv bar
New python executable in /Users/andy.smith/foo/bar/bin/python2.7
Also creating executable in /Users/andy.smith/foo/bar/bin/python
Installing setuptools, pip, wheel...
Complete output from command /Users/andy.smith/foo/bar/bin/python2.7 - setuptools pip wheel:
Looking in links: /usr/local/lib/python2.7/site-packages, /usr/local/lib/python2.7/site-packages/virtualenv_support, /usr/local/lib/python2.7/site-packages/virtualenv_support
Collecting setuptools
Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/basecommand.py", line 228, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/commands/install.py", line 291, in run
resolver.resolve(requirement_set)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/resolve.py", line 103, in resolve
self._resolve_one(requirement_set, req)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/resolve.py", line 257, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/resolve.py", line 210, in _get_abstract_dist_for
self.require_hashes
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/operations/prepare.py", line 245, in prepare_linked_requirement
req.populate_link(finder, upgrade_allowed, require_hashes)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/req/req_install.py", line 307, in populate_link
self.link = finder.find_requirement(self, upgrade)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 484, in find_requirement
all_candidates = self.find_all_candidates(req.name)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 442, in find_all_candidates
for page in self._get_pages(url_locations, project_name):
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 587, in _get_pages
page = self._get_page(location)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 705, in _get_page
return HTMLPage.get_page(link, session=self.session)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/index.py", line 814, in get_page
"Cache-Control": "max-age=600",
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 397, in request
return super(PipSession, self).request(method, url, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 625, in send
r = dispatch_hook('response', hooks, r, **kwargs)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_vendor/requests/hooks.py", line 31, in dispatch_hook
_hook_data = hook(hook_data, **kwargs)
File "/usr/local/lib/python2.7/site-packages/virtualenv_support/pip-10.0.1-py2.py3-none-any.whl/pip/_internal/download.py", line 189, in handle_401
username = six.moves.input("User for %s: " % parsed.netloc)
EOFError: EOF when reading a line
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 712, in main
symlink=options.symlink)
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 947, in create_environment
download=download,
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 904, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 796, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/andy.smith/foo/bar/bin/python2.7 - setuptools pip wheel failed with error code 2
谢谢!