1. 程式人生 > >用virtualenv建立一個獨立的Python執行環境時報錯

用virtualenv建立一個獨立的Python執行環境時報錯

[email protected]:~/桌面/myproject$ virtualenv --no-site-packages p1
New python executable in /home/dorothy/桌面/myproject/p1/bin/python
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 14: ordinal not in range(128)
ERROR: The executable /home/dorothy/桌面/myproject/p1/bin/python is not functioning
ERROR: It thinks sys.prefix is u'/home/dorothy/\u684c\u9762/myproject' (should be u'/home/dorothy/\u684c\u9762/myproject/p1')
ERROR: virtualenv is not compatible with this system or executable

報錯。

解決:

將資料夾的路徑更改到沒有漢字的地方,比如,將資料夾建立在home下:

[email protected]:~/ZX/myproject$ virtualenv --no-site-packages p1
New python executable in /home/dorothy/ZX/myproject/p1/bin/python
Installing setuptools, pip, wheel...done.
[email protected]:~/ZX/myproject$ 

成功。