出错位置,准备工作,创建虚拟环境。
出错问题,与pipenv有关。
在查询pipenv版本时报错。
输入:pipenv --version
报错:
Traceback (most recent call last):
File “c:\python37\lib\runpy.py”, line 193, in run_module_as_main
“main”, mod_spec)
File “c:\python37\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\python37\Scripts\pipenv.exe_main.py", line 5, in
File "c:\python37\lib\site-packages\pipenv_init.py", line 47, in
from .cli import cli
File “c:\python37\lib\site-packages\pipenv\cli_init_.py”, line 3, in
from .command import cli
File “c:\python37\lib\site-packages\pipenv\cli\command.py”, line 7, in
import crayons
File “c:\python37\lib\site-packages\pipenv\patched\crayons.py”, line 49, in
is_powershell = “powershell” in shellingham.detect_shell()[0]
File “c:\python37\lib\site-packages\pipenv\vendor\shellingham_init_.py”, line 22, in detect_shell
shell = get_shell(pid, max_depth=max_depth)
File “c:\python37\lib\site-packages\pipenv\vendor\shellingham\nt.py”, line 100, in get_shell
processes = dict(_iter_process())
File “c:\python37\lib\site-packages\pipenv\vendor\shellingham\nt.py”, line 78, in _iter_process
info = {‘executable’: str(pe.szExeFile.decode(‘utf-8’))}
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xcc in position 0: invalid continuation byte
最后的报错和utf8有关,个人认为和中文有关,可是我的python和当前工作区域都没有中文。后来百度,说是和其他正在运行的中文程序有关,重启后,没有这问题,但过一会儿后又会出现此问题。换成pip启动虚拟环境没有任何问题。
上stack和思否都没有找到能解决的方案。