windows10 + python2.7.9
在桌面创建虚拟环境的时候出现:
C:\Users\我们都是小怪兽\Desktop>virtualenv myenv
New python executable in C:\Users\我们都是小怪兽\Desktop\myenv\Scripts\python.exe
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 9: ordinal not in range(128)
ERROR: The executable C:\Users\我们都是小怪兽\Desktop\myenv\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is u'c:\\users\\\u6211\u4eec\u90fd\u662f\u5c0f\u602a\u517d\\desktop' (should be u'c:\\users\\\u6211\u4eec\u90fd\u662f\u5c0f\u602a\u517d\\desktop\\myenv')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
除了桌面的其他目录出现这个:
PS C:\> cd D:\Coding\python
PS D:\Coding\python> virtualenv env
New python executable in D:\Coding\python\env\Scripts\python.exe
Installing setuptools, pip, wheel...
Complete output from command D:\Coding\python\env\Scripts\python.exe - setuptools pip wheel:
Collecting setuptools
Exception:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\basecommand.py", line 209, in main
status = self.run(options, args)
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\commands\install.py", line 299, in run
requirement_set.prepare_files(finder)
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\req\req_set.py", line 359, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\req\req_set.py", line 576, in _prepare_file
session=self.session, hashes=hashes)
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\download.py", line 809, in unpack_url
hashes=hashes
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\download.py", line 648, in unpack_http_url
hashes)
File "c:\python27\lib\site-packages\virtualenv_support\pip-8.0.2-py2.py3-none-any.whl\pip\download.py", line 868, in _download_http_url
file_path = os.path.join(temp_dir, filename)
File "D:\Coding\python\env\lib\ntpath.py", line 85, in join
result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xce in position 7: ordinal not in range(128)
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\virtualenv.py", line 711, in main
symlink=options.symlink)
File "c:\python27\lib\site-packages\virtualenv.py", line 944, in create_environment
download=download,
File "c:\python27\lib\site-packages\virtualenv.py", line 900, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "c:\python27\lib\site-packages\virtualenv.py", line 795, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command D:\Coding\python\env\Scripts\python.exe - setuptools pip wheel failed with error code 2
想不通是什么问题,求解。
补充:如果加上 --no setuptools就可以了
PS D:\Coding\python> virtualenv myenv --no-setuptools
New python executable in D:\Coding\python\myenv\Scripts\python.exe
Installing pip, wheel...done.