python创建虚拟环境报错unicodedecodeerror_windows使用pipenv创建虚拟环境报错UnicodeDecodeError: 'utf-8' codec can't deco...

Traceback (most recent call last):

File "c:\python37-32\lib\runpy.py", line 193, in _run_module_as_main

"__main__", mod_spec)

File "c:\python37-32\lib\runpy.py", line 85, in _run_code

exec(code, run_globals)

File "C:\Python37-32\Scripts\pipenv.exe\__main__.py", line 5, in

File "c:\python37-32\lib\site-packages\pipenv\__init__.py", line 23, in

from .cli import cli

File "c:\python37-32\lib\site-packages\pipenv\cli\__init__.py", line 3, in

from .command import cli

File "c:\python37-32\lib\site-packages\pipenv\cli\command.py", line 7, in

import crayons

File "c:\python37-32\lib\site-packages\pipenv\patched\crayons.py", line 49, in

is_powershell = "powershell" in shellingham.detect_shell()[0]

File "c:\python37-32\lib\site-packages\pipenv\vendor\shellingham\__init__.py", line 22, in detect_shell

shell = get_shell(pid, max_depth=max_depth)

File "c:\python37-32\lib\site-packages\pipenv\vendor\shellingham\nt.py", line 100, in get_shell

processes = dict(_iter_process())

File "c:\python37-32\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 0xce in position 4: invalid continuation byte

原因:

因为windows默认GBK编码,所以报错

解决方法:

最正确的解决方式不清楚,我的解决方式是修改源码,亲测有效:

将你报错位置的(报错位置在你的错误信息里)

str(pe.szExeFile.decode('utf-8')

改为

str(pe.szExeFile.decode('gbk')

然后就解决了,不喜勿喷,有更好的解决办法请分享~

成功启动

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值