使用pipenv install出现utf-8不能decode的问题

报错的大致内容:UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xb6 in position 0: invalid start byte

这是我的报错:

F:\fisher>pipenv install
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

首先提醒大家不是路径有中文的问题,所以卸载重装一个英文路径是没有用的,别问我是怎么知道的TVT(这不可能)

在网上找了好多方法,都试了,然而没啥用,但是到最后我的操作过程是

  • 卸载(已经卸载好多次了)
  • 电脑崩溃了
  • 重启
  • 找到一开始安装的文件夹(他的默认安装文件夹C:\Users\yww\AppData\Local\Programs\Python\)
  • 删除遗留的东西——重新安装(在英文路径中)
  • △执行pip install setuptools==34.3.3
  • 执行python -m pip install --upgrade pip
  • 执行pip install pipenv
  • 执行pipenv install
    太开心了
    #不过最后想了一下好像可能也许是执行pip install setuptools==34.3.3这一句的功劳

# 2

2019/2/25

又一次遇到这种情况了
使用pipenv install出现utf-8不能decode的问题_第1张图片
按照评论中 大佬说的 看了一下进程

使用pipenv install出现utf-8不能decode的问题_第2张图片
确实有中文的进程,那么直接重启吧,懒得去一个一个停了
使用pipenv install出现utf-8不能decode的问题_第3张图片
好了成功创建了一个虚拟环境
再次膜拜大佬

你可能感兴趣的:(python)