簡單的解決方法是:改變你的名字;)當然我是在開玩笑,你不應該改變你的名字,因爲一些工具被打破了!
我可以重現你的問題virtualenv
:
/tmp$ mkdir "Carlos Andrés Moreno"
/tmp$ cd Carlos\ Andrés\ Moreno/
/tmp/Carlos Andrés Moreno$ virtualenv kernel
New python executable in kernel/bin/python2
Also creating executable in kernel/bin/python
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 16: ordinal not in range(128)
ERROR: The executable kernel/bin/python2 is not functioning
ERROR: It thinks sys.prefix is u'/tmp/Carlos Andr\xe9s Moreno' (should be u'/tmp/Carlos Andr\xe9s Moreno/kernel')
ERROR: virtualenv is not compatible with this system or executable
對於使用virtualenvwrapper,我沒有任何問題:
/tmp/Carlos Andrés Moreno$ mkvirtualenv kernel
New python executable in kernel/bin/python2
Also creating executable in kernel/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /home/wglenn/.virtualenvs/kernel/bin/predeactivate
virtualenvwrapper.user_scripts creating /home/wglenn/.virtualenvs/kernel/bin/postdeactivate
virtualenvwrapper.user_scripts creating /home/wglenn/.virtualenvs/kernel/bin/preactivate
virtualenvwrapper.user_scripts creating /home/wglenn/.virtualenvs/kernel/bin/postactivate
virtualenvwrapper.user_scripts creating /home/wglenn/.virtualenvs/kernel/bin/get_env_details
(kernel)/tmp/Carlos Andrés Moreno$
似乎他們更小心處理非ASCII字符。因此,請嘗試使用virtualenvwrapper.sh的mkvirtualenv
幫助程序功能
來源
2016-04-20 15:05:40
wim
您是否嘗試在腳本的開頭添加'#encoding:utf-8'? – Krishh
我在virtualenv文件'重新加載(sys) sys.setdefaultencoding('Cp1252')'wirtten併爲我工作。看到http://stackoverflow.com/questions/21129020/how-to-fix-unicodedecodeerror-ascii-codec-cant-decode-byte – CarMoreno