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

Python 安装 mitmproxy 报错:'str' object has no attribute 'decode'
二次蓝 Lv4

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

截取自报错文本:

1
2
3
4
5
6
7
8
9
    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'

1
2
3
4
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,成功。

  • 标题: Python 安装 mitmproxy 报错:'str' object has no attribute 'decode'
  • 作者: 二次蓝
  • 创建于 : 2021-03-28 12:01:03
  • 更新于 : 2021-05-10 09:59:00
  • 链接: https://blog.ercilan.cn/2021/03/28/Python-安装-mitmproxy-报错:'str'-object-has-no-attribu/
  • 版权声明: 本文章采用 CC BY-NC-SA 4.0 进行许可。
评论
目录
Python 安装 mitmproxy 报错:'str' object has no attribute 'decode'