夜阑卧听风吹雨

铁马冰河入梦来

Loading

Python 安装 mitmproxy 报错:'str' object has no attribute 'decode'

报错: AttributeError: 'str' object has no attribute 'decode'

截取自报错文本:

    File "D:\Anaconda3\lib\site-packages\setuptools\msvc.py", line 192, in _msvc14_find_vc2017
      path = subprocess.check_output([
  AttributeError: 'str' object has no attribute 'decode'
  ----------------------------------------
  ERROR: Failed building wheel for urwid
  Running setup.py clean for urwid
Failed to build urwid
Installing collected packages: urwid, ruamel.yaml, pyperclip, pydivert, publicsuffix2, protobuf, passlib, ldap3, kaitaistruct, h2, Brotli, blinker, asgiref, mitmproxy
    Running setup.py install for urwid ... error

图片

解决

出现了两次这样的错误,根据调用栈,我们来到 D:\Anaconda3\Lib\site-packages\setuptools\msvc.py,192 行,往下看到:
图片
修改:
图片
再次 pip install mitmproxy,前面的错误已经解决了,但是末尾再次报错。

报错:Cannot uninstall 'ruamel-yaml'

Installing collected packages: urwid, ruamel.yaml, pyperclip, pydivert, publicsuffix2, protobuf, passlib, ldap3, kaitaistruct, h2, Brotli, blinker, asgiref, mitmproxy
  Attempting uninstall: ruamel.yaml
    Found existing installation: ruamel-yaml 0.15.87
ERROR: Cannot uninstall 'ruamel-yaml'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

图片

conda环境安装datapane报错ERROR: Cannot uninstall ‘ruamel-yaml‘_weixin_46115371的博客

这里,我是打算将 mitmproxy 安进 base 环境的,之前应该是作为依赖已经被安装过了。这里我们进入 D:\Anaconda3\Lib\site-packages,删除 ruamel 开头的文件夹和一个 .info 文件,再次重新安装 mitmproxy,成功。

posted @ 2021-03-28 12:01  二次蓝  阅读(755)  评论(0编辑  收藏  举报