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
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
werkzeug的一个bug。
https://github.com/pallets/we...
在python36后就有的,用python35吧。
楼下那个答案说的不对,因为./Python36/lib/site-packages/werkzeug/serving.py的写法如下:
所以不存在大小写的问题。
Python3以后,SocketServer这个模块的命名变成了socketserver。
在Python2.7的文档开头的NOTE里面就有写:
SocketServer — A framework for network servers
我是使用的2.7的Python,所以也没有尝试过,建议把模块的名字改一下再试试。
这种问题首先进入virtualenv直接进在命令行敲python, 进去之后直接import SocketServer 看能不能导入,不能就肯定是名字错了或者缺包。