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

问题描述 投票:1回答:1

这个问题在这里已有答案:

我是Flask开发的初学者。

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

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

请帮我解决这两个问题。

我的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.
python cmd flask virtualenv
1个回答
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或类似。

如果这不使用virtualenvwrapperWORKON_HOME建议无效。相反,你可以先cd到另一个目录:

mkdir c:\virtualenvs
cd C:\virtualenvs
virtualenv (the virtualenv name)
© www.soinside.com 2019 - 2024. All rights reserved.