gpt4 book ai didi

python - 我该如何修复这个 mitmproxys SyntaxError?

转载 作者:太空宇宙 更新时间:2023-11-04 11:21:09 24 4
gpt4 key购买 nike

我正在 Amazon AWS EC2 服务器上安装 mitmproxy,但我将 mitmproxy 写入终端后出现以下异常。通过谷歌我还没有找到任何东西 :( 我希望这里有人可以帮助我。(如果是的话,我可能发布了一些信息,我很抱歉 :'[ )

  Traceback (most recent call last) :
File "/usr/bin/mitmproxy", line 19, in <module>
from libmproxy import proxy, console, cmdline, version
File "/usr/lib/python2.6/site-packages/libmproxy/proxy.py", line 20, in <module>
import utils, flow, version, platform, controller, app
File "usr/lib/python2.6/site-packages/libmproxy/flow.py", line 789
cookie_parameters = {key.strip().lower() :value.strip() for key,sep,value in pairs[1:]}

SyntaxError: invalid syntax

cat/proc/version 给我以下信息

Linux 版本 3.4.48-45.46.amzn1.i686 (mockbuild@gobi-build-31004) (gcc 版本 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #1 SMP Wed 2013 年 6 月 12 日 02:04:37 UTC

通过将 python -V 写入终端我得到 Python 2.7.3

通过 pip list

 argparse (1.2.1)
BeautifulSoup (3.2.1)
Flask (0.10.1)
itsdangerous (0.23)
Jinja2 (2.7.1)
lxml (3.2.3)
MarkupSafe (0.18)
mechanize (0.2.5)
mitmproxy (0.9.1)
netlib (0.9.1)
PIL (1.1.7)
pip (1.4.1)
protobuf (2.5.0)
PyAMF (0.6.1)
pyasn1 (0.1.7)
pyOpenSSL (0.13)
Scrapy (0.18.0)
setuptools (0.6c11)
urwid (1.1.1)
virtualenv (1.10.1)
Werkzeug (0.9.3)
wsgiref (0.1.2)

通过 pip-2.6 列表

 argparse (1.2.1)
aws-cfn-bootstrap (1.3)
backports.ssl-match-hostname (3.2a3)
certifi (0.0.8)
chardet (2.0.1)
Cheetah (2.4.1)
cloud-init (0.5.15)
configobj (4.6.0)
distribute (0.6.10)
Flask (0.10.1)
iniparse (0.3.1)
itsdangerous (0.23)
Jinja2 (2.7.1)
lockfile (0.8)
lxml (3.2.3)
M2Crypto (0.20.2)
Markdown (2.0.1)
MarkupSafe (0.18)
mitmproxy (0.9.1)
netlib (0.9.1)
ordereddict (1.1)
PIL (1.1.6)
pip (1.4.1)
protobuf (2.5.0)
pyasn1 (0.1.7)
pycurl (7.19.0)
Pygments (1.4)
pygpgme (0.1)
pyOpenSSL (0.13)
pystache (0.5.2)
python-daemon (1.5.2)
PyYAML (3.10)
requests (1.1.0)
Exception:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/basecommand.py", line 134, in main
status = self.run(options, args)
File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py", line 80, in run
self.run_listing(options)
File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py", line 127, in run_listing
self.output_package_listing(installed_packages)
File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/commands/list.py", line 136, in output_package_listing
if dist_is_editable(dist):
File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/util.py", line 347, in dist_is_editable
req = FrozenRequirement.from_dist(dist, [])
File "/usr/lib/python2.6/site-packages/pip-1.4.1-py2.6.egg/pip/__init__.py", line 194, in from_dist
assert len(specs) == 1 and specs[0][0] == '=='
AssertionError

Storing complete log in /home/ec2-user/.pip/pip.log

通过 pip-2.7 列表

 argparse (1.2.1)
BeautifulSoup (3.2.1)
Flask (0.10.1)
itsdangerous (0.23)
Jinja2 (2.7.1)
lxml (3.2.3)
MarkupSafe (0.18)
mechanize (0.2.5)
mitmproxy (0.9.1)
netlib (0.9.1)
PIL (1.1.7)
pip (1.4.1)
protobuf (2.5.0)
PyAMF (0.6.1)
pyasn1 (0.1.7)
pyOpenSSL (0.13)
Scrapy (0.18.0)
setuptools (0.6c11)
urwid (1.1.1)
virtualenv (1.10.1)
Werkzeug (0.9.3)
wsgiref (0.1.2)

最好的,雪N

最佳答案

File "usr/lib/python2.6/site-packages/libmproxy/flow.py", line 789

Python 2.6 没有字典推导;您将需要重写它以使用 (key, value) 对的可迭代调用 dict 构造函数。

关于python - 我该如何修复这个 mitmproxys SyntaxError?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18208535/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com