Wenn ich mitmproxy Befehl in der Befehlszeile ausführen, erhalte ich den folgenden Fehler.ImportError: Kein Modul namens 'Thread'
% mitmproxy
Traceback (most recent call last):
File "/usr/local/bin/mitmproxy", line 7, in <module>
from libmproxy.main import mitmproxy
File "/usr/local/lib/python3.5/site-packages/libmproxy/main.py", line 5, in <module>
import thread
ImportError: No module named 'thread'
gegoogelt ich diesen Fehler und fand diese Stackoverflow Q & A-Seite.
pydev importerror: no module named thread, debugging no longer works after pydev upgrade
nach der Seite oben, tritt der Fehler auf, weil Modul "thread
" umbenannt wird auf "_thread
" in python3.
Also, ich weiß, was diesen Fehler verursacht, aber was dann?
Ich weiß nicht, was jetzt zu tun ist, um diesen Fehler loszuwerden.
Ich bin neu in Python. Ich habe gerade Python und pip
in meinem Mac OSX wie unten gezeigt installiert, weil ich mitmproxy verwenden möchte.
% which pip
/usr/local/bin/pip
% pip --version
pip 8.1.1 from /usr/local/lib/python3.5/site-packages (python 3.5)
% which python
/usr/bin/python
% which python3
/usr/local/bin/python3
% python --version
Python 2.7.10
% python3 --version
Python 3.5.1
könnte mir bitte jemand sagen, was ich jetzt tun soll?
Zusätzliche Informationen
Als @linusg beantwortet, habe ich "thread.py
" Datei in "site-packages" Verzeichnis und den Code unten in klebte "thread.py
"
from _thread import *
__all__ = ("error", "LockType", "start_new_thread", "interrupt_main", "exit", "allocate_lock", "get_ident", "stack_size", "acquire", "release", "locked")
Nachdem ich dies tat , "ImportError: No module named 'thread'
" verschwunden, aber jetzt habe ich einen anderen ImportError, der "import Cookie ImportError: No module named 'Cookie'
" ist.
Es scheint, dass in Python 3, Cookie
Modul in http.cookies
(stackoverflow.com/questions/3522029/django-mod-python-error) umbenannt wird.
Nun, was soll ich tun?
Was ich habe, in "site-packages" Verzeichnis
% ls /usr/local/lib/python3.5/site-packages (git)-[master]
ConfigArgParse-0.10.0.dist-info/ mitmproxy-0.15.dist-info/
OpenSSL/ netlib/
PIL/ netlib-0.15.1.dist-info/
Pillow-3.0.0.dist-info/ passlib/
PyYAML-3.11.dist-info/ passlib-1.6.5.dist-info/
__pycache__/ pathtools/
_cffi_backend.cpython-35m-darwin.so* pathtools-0.1.2.dist-info/
_markerlib/ pip/
_watchdog_fsevents.cpython-35m-darwin.so* pip-8.1.1.dist-info/
argh/ pkg_resources/
argh-0.26.1.dist-info/ pyOpenSSL-0.15.1.dist-info/
backports/ pyasn1/
backports.ssl_match_hostname-3.5.0.1.dist-info/ pyasn1-0.1.9.dist-info/
blinker/ pycparser/
blinker-1.4.dist-info/ pycparser-2.14.dist-info/
certifi/ pyparsing-2.0.7.dist-info/
certifi-2016.2.28.dist-info/ pyparsing.py
cffi/ pyperclip/
cffi-1.6.0.dist-info/ pyperclip-1.5.27.dist-info/
click/ setuptools/
click-6.2.dist-info/ setuptools-19.4-py3.5.egg-info/
configargparse.py sitecustomize.py
construct/ six-1.10.0.dist-info/
construct-2.5.2.dist-info/ six.py
cryptography/ test/
cryptography-1.1.2.dist-info/ thread.py
easy_install.py tornado/
hpack/ tornado-4.3.dist-info/
hpack-2.0.1.dist-info/ urwid/
html2text/ urwid-1.3.1.dist-info/
html2text-2015.11.4.dist-info/ watchdog/
idna/ watchdog-0.8.3.dist-info/
idna-2.1.dist-info/ wheel/
libmproxy/ wheel-0.26.0-py3.5.egg-info/
lxml/ yaml/
lxml-3.4.4.dist-info/
Dank für Ihre Hilfe danken! Ich werde es jetzt versuchen! – hytm
jetzt habe ich einen weiteren Fehler, der unten ist. File "/usr/local/lib/python3.5/site-packages/libmproxy/models/http.py", Zeile 2, in Import Plätzchen Import: Kein Modul namens 'Cookie' –
hytm
es scheint, dass in Das python3-Cookie-Modul wurde in http.cookies umbenannt. (http://stackoverflow.com/questions/3522029/django-mod-python-error) – hytm