C:\Users\jowu\virtualEnvironment\Scripts\python.exe C:/Users/jowu/Desktop/PyWeb/PyWeb.py
Traceback (most recent call last):
File "C:\Users\jowu\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\serving.py", line 65, in <module>
from SocketServer import ThreadingMixIn, ForkingMixIn
ImportError: No module named 'SocketServer'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/jowu/Desktop/PyWeb/PyWeb.py", line 12, in <module>
app.run()
File "C:\Users\jowu\AppData\Local\Programs\Python\Python36\lib\site-packages\flask\app.py", line 828, in run
from werkzeug.serving import run_simple
File "C:\Users\jowu\AppData\Local\Programs\Python\Python36\lib\site-packages\werkzeug\serving.py", line 68, in <module>
from socketserver import ThreadingMixIn, ForkingMixIn
ImportError: cannot import name 'ForkingMixIn'
Process finished with exit code 1
大家讲道理2017-04-18 09:21:03
A bug by werkzeug.
https://github.com/pallets/we...
It is available after python36, use python35.
The answer below is wrong, because ./Python36/lib/site-packages/werkzeug/serving.py is written as follows:
try:
from SocketServer import ThreadingMixIn, ForkingMixIn
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
except ImportError:
from socketserver import ThreadingMixIn, ForkingMixIn
from http.server import HTTPServer, BaseHTTPRequestHandler
So there is no case problem.
天蓬老师2017-04-18 09:21:03
After Python 3, the name of the SocketServer module changed to socketserver.
It is written in the NOTE at the beginning of the Python2.7 document:
SocketServer — A framework for network servers
I am using Python 2.7, so I have not tried it. It is recommended to change the name of the module and try again.
阿神2017-04-18 09:21:03
For this kind of problem, first enter virtualenv and type python directly on the command line. After entering, directly import SocketServer to see if it can be imported. If not, it must be that the name is wrong or the package is missing.