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
werkzeug的一个bug。
https://github.com/pallets/we...
在python36后就有的,用python35吧。
楼下那个答案说的不对,因为./Python36/lib/site-packages/werkzeug/serving.py的写法如下:
try:
from SocketServer import ThreadingMixIn, ForkingMixIn
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
except ImportError:
from socketserver import ThreadingMixIn, ForkingMixIn
from http.server import HTTPServer, BaseHTTPRequestHandler
所以不存在大小写的问题。
天蓬老师2017-04-18 09:21:03
Python3以后,SocketServer这个模块的命名变成了socketserver。
在Python2.7的文档开头的NOTE里面就有写:
SocketServer — A framework for network servers
我是使用的2.7的Python,所以也没有尝试过,建议把模块的名字改一下再试试。
阿神2017-04-18 09:21:03
这种问题首先进入virtualenv直接进在命令行敲python, 进去之后直接import SocketServer 看能不能导入,不能就肯定是名字错了或者缺包。