virtualenv与此系统或可执行程序不兼容..!

时间:2015-10-18 03:54:16

标签: python cmd flask virtualenv

我是Flask开发的初学者。

当我尝试使用virtualenv时,它会一直向我显示错误。 我在网上搜索并尝试了他们推荐的所有内容,例如升级virtualenv,移动DLLs文件夹,移动Python35.dll文件等等。但它不起作用!

我也有激活问题, C:\ Users \用户형철\ VENV \激活 它也不起作用......

请帮我解决这两个问题。

我的python版本是3.5 我使用窗口8。

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\형철>virtualenv venv
Using base prefix 'c:\\users\\형철\\appdata\\local\\programs\\python\\python35'
New python executable in venv\Scripts\python.exe
Failed to import the site module
Traceback (most recent call last):
File "C:\Users\형철\venv\lib\site.py", line 703, in <module>
main()
File "C:\Users\형철\venv\lib\site.py", line 670, in main
virtual_install_main_packages()
File "C:\Users\형철\venv\lib\site.py", line 554, in virtual_install_main_packa
ges
sys.real_prefix = f.read().strip()
UnicodeDecodeError: 'cp949' codec can't decode byte 0xed in position 9: illegal
multibyte sequence
ERROR: The executable venv\Scripts\python.exe is not functioning
ERROR: It thinks sys.prefix is 'c:\\users\\형철' (should be 'c:\\users\\형철\\ve
nv')
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 app
ropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.

1 个答案:

答案 0 :(得分:0)

也许还有其他的env设置可以解决这个问题,但是我会覆盖WORKON_HOME变量(确定存储virtualenvs的位置)来使用没有Hangul字符的东西,它似乎很难解决这些。我能够重现:

.whogan:~/tmp$ export WORKON_HOME=~/tmp/형철
.whogan:~/tmp$ mkvirtualenv django-dev
New python executable in django-dev/bin/python
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xed in position 17: ordinal not in range(128)
ERROR: The executable django-dev/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/whogan/tmp/\ud615\ucca0' (should be u'/home/whogan/tmp/\ud615\ucca0/django-dev')
ERROR: virtualenv is not compatible with this system or executable

WORKON_HOME切换到另一个路径会解决此问题:

.whogan:~/tmp$ export WORKON_HOME=~/tmp/venvs
.whogan:~/tmp$ mkvirtualenv django-dev
New python executable in django-dev/bin/python
Installing setuptools, pip, wheel...done.
(django-dev).whogan:~/tmp$ 

也许设置为C:\ virtualenvs或类似。

如果未使用virtualenvwrapper,则WORKON_HOME建议无效。相反,您可以先cd到另一个目录:

mkdir c:\virtualenvs
cd C:\virtualenvs
virtualenv (the virtualenv name)