gpt4 book ai didi

python - Virtualenv 和 Anaconda 问题

转载 作者:太空狗 更新时间:2023-10-30 01:01:37 26 4
gpt4 key购买 nike

所以这个问题以前也有人提出过,但是我还没有找到合适的解决办法。

我在 Mac 上。当我在终端中运行 python 时,我得到:

Python 2.7.6 |Anaconda 1.9.2 (x86_64)| (default, Jan 10 2014, 11:23:15) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin

我不太明白那是什么意思,它是用 Anaconda 运行 Python 2.7.6 吗?

无论如何,我的问题是我无法设置 virtualenv。当我尝试创建虚拟环境时,我收到此错误消息:

New python executable in virtualenvs/bin/python
Installing setuptools, pip...
Complete output from command /Users/arashsaidi/virtualenvs/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip:
Ignoring indexes: https://pypi.python.org/simple/
Exception:
Traceback (most recent call last):
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/commands/install.py", line 236, in run
session = self._build_session(options)
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/basecommand.py", line 52, in _build_session
session = PipSession()
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/download.py", line 216, in __init__
super(PipSession, self).__init__(*args, **kwargs)
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/requests/sessions.py", line 273, in __init__
self.headers = default_headers()
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/requests/utils.py", line 555, in default_headers
'User-Agent': default_user_agent(),
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv_support/pip-1.5.6-py2.py3-none-any.whl/pip/_vendor/requests/utils.py", line 524, in default_user_agent
_implementation = platform.python_implementation()
File "/Users/arashsaidi/anaconda/lib/python2.7/platform.py", line 1499, in python_implementation
return _sys_version()[0]
File "/Users/arashsaidi/anaconda/lib/python2.7/platform.py", line 1464, in _sys_version
repr(sys_version))
ValueError: failed to parse CPython sys.version: '2.7.5 (default, Aug 25 2013, 00:04:04) \n[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]'

Storing debug log for failure in /var/folders/jg/hs6w4q8x10n4ycwwf06dnp440000gn/T/tmpmM9rRS
----------------------------------------
...Installing setuptools, pip...done.
Traceback (most recent call last):
File "/Users/arashsaidi/anaconda/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv.py", line 824, in main
symlink=options.symlink)
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv.py", line 992, in create_environment
install_wheel(to_install, py_executable, search_dirs)
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv.py", line 960, in install_wheel
'PIP_NO_INDEX': '1'
File "/Users/arashsaidi/anaconda/lib/python2.7/site-packages/virtualenv.py", line 902, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/arashsaidi/virtualenvs/bin/python -c "import sys, pip; sys...d\"] + sys.argv[1:]))" setuptools pip failed with error code 2

你能帮我找到解决办法吗?

最佳答案

virtualenv 包不适用于 Anaconda。在终端提示符下,您应该使用 conda 语句 conda -n new_env_name 创建一个新的虚拟环境,如 in the docs 所述.

关于python - Virtualenv 和 Anaconda 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23805106/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com