0

我正在亚马逊 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 version 3.4.48-45.46.amzn1.i686 (mockbuild@gobi-build-31004) (gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC) ) #1 SMP Wed Jun 12 02:04:37 UTC 2013

通过写入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 list

 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 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)

最好的,雪诺

4

1 回答 1

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

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

于 2013-08-13T12:05:00.317 回答