使用pipenv管理python的包,并且把虚拟环境也集成到工具中,我们可以很方便的启动python运行的虚拟环境,减少因包的版本不同出现的问题。
以下内容是作者在日常工作中使用pipenv出现的问题
报错内容
Traceback (most recent call last):
File "f:\python3\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "f:\python3\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "F:\python3\Scripts\pipenv.exe\__main__.py", line 5, in <module>
File "f:\python3\lib\site-packages\pipenv\__init__.py", line 23, in <module>
from .cli import cli
File "f:\python3\lib\site-packages\pipenv\cli\__init__.py", line 3, in <module>
from .command import cli
File "f:\python3\lib\site-packages\pipenv\cli\command.py", line 7, in <module>
import crayons
File "f:\python3\lib\site-packages\pipenv\patched\crayons.py", line 48, in <module>
is_powershell = "powershell" in shellingham.detect_shell()[0]
File "f:\python3\lib\site-packages\pipenv\vendor\shellingham\__init__.py", line 22, in detect_shell
shell = get_shell(pid, max_depth=max_depth)
File "f:\python3\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 100, in get_shell
processes = dict(_iter_process())
File "f:\python3\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 0xb6 in position 0: invalid start byte
一般重启电脑就可以解决这个问题,但是根本原因没有找到,通过网上查找资料,有网友说有中文进程在运行,打开==任务管理器==发现确实有中文进程在运行,结束中文进程后恢复正常。