python - 在 Windows 7 上,通过 python setuptools easy_install 安装 mitmproxy 时出现解码错误 "ascii"

标签 python mitmproxy

当我尝试在 windows 7 上通过 easy_install安装 mitmproxy 时,出现ascii 错误

这是 cmd 的控制台结果。

C:\Python27\Scripts>easy_install D:_python\mitmproxy-0.9.2

Processing mitmproxy-0.9.2

Writing D:_python\mitmproxy-0.9.2\setup.cfg

Running setup.py -q bdist_egg --dist-dir D:_python\mitmproxy-0.9.2\egg-dist-tmp -qdtwhc

zip_safe flag not set; analyzing archive contents...

libmproxy.utils: module references file

libmproxy.contrib.pyparsing: module MAY be using inspect.stack

libmproxy.contrib.jsbeautifier.unpackers.init: module references path mitmproxy 0.9.2 is already the active version in easy-install.pth

Installing mitmdump script to C:\Python27\Scripts

Installing mitmproxy script to C:\Python27\Scripts

Installed c:\python27\lib\site-packages\mitmproxy-0.9.2-py2.7.egg

Processing dependencies for mitmproxy==0.9.2

Searching for pyopenssl>=0.13

Reading https://pypi.python.org/simple/pyopenssl/

Best match: pyOpenSSL 0.13.1

Downloading https://pypi.python.org/packages/2.7/p/pyOpenSSL/pyOpenSSL-0.13.1.win32-py2.7.exe#md5=02b016ed32fffcff56568e5834edcae6

Processing pyOpenSSL-0.13.1.win32-py2.7.exe

Traceback (most recent call last):
File "C:\Python27\Scripts\easy_install-script.py", line 9, in module load_entry_point('setuptools==1.1.6', 'console_scripts', 'easy_install')()

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 1925, in main

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 1912, in with_ei_usage

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 1929, in lambda

File "C:\Python27\lib\distutils\core.py", line 152, in setup dist.run_commands()

File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd)

File "C:\Python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run()

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 374, in run

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 590, in easy_install

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 641, in install_item

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 687, in process_distribution

File "build\bdist.win32\egg\pkg_resources.py", line 568, in resolve

File "build\bdist.win32\egg\pkg_resources.py", line 806, in best_match

File "build\bdist.win32\egg\pkg_resources.py", line 818, in obtain

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 609, in easy_install

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 639, in install_item

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 792, in install_eggs

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 869, in install_exe

File "build\bdist.win32\egg\setuptools\command\easy_install.py", line 1379, in extract_wininst_cfg

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 27: ordinal not in range(128)

请有人帮助我!

热烈的问候, 里西

最佳答案

如果使用 Python 2.x,您可以评论此违规行:

# config = config.decode('ascii')

在 easy_install.py 中(第 1510 行附近):

# Now the config is in bytes, but on Python 3, it must be
#  unicode for the RawConfigParser, so decode it. Is this the
#  right encoding?
config = config.decode('ascii')
cfg.readfp(StringIO(config))

关于python - 在 Windows 7 上,通过 python setuptools easy_install 安装 mitmproxy 时出现解码错误 "ascii",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19536068/

相关文章:

networking - 强制流量从一个 pod 到另一个

ssl - MITM 代理忽略 Android 应用程序的 SSL 证书验证

python - 在 Python 中锁定免费只读列表?

python - 如何使用 python 将列表索引值向前移动 'x' 次?

Python min 和 max 函数,但带有索引

Python os.remove(filename) 抛出错误 "already being used by temp"

python - 覆盖继承类中的基变量

networking - Mitmproxy url 过滤器

mitmproxy - 如何解析Mitmdump/Mitmproxy内容

python - Mitmproxy 上游服务器