ModuleNotFoundError:没有名为“ SocketServer”的模块

时间:2019-09-25 06:41:46

标签: python-3.x

我正在使用python 3.7.4导入所有小写字母的socketserver,但仍然出现错误

from flask import Flask,flash,redirect,render_template,request,sessions,abort
import socketserver
app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello world"
if __name__=="__main__":
    app.run()
  

ModuleNotFoundError:没有名为“ SocketServer”的模块

1 个答案:

答案 0 :(得分:0)

也许您必须在运行 Flask 应用程序之前运行 boot.sh

否则

try:
   import socketserver
   from http.server import BaseHTTPRequestHandler
   from http.server import HTTPServer
except ImportError:
   import SocketServer as socketserver
   from BaseHTTPServer import HTTPServer
   from BaseHTTPServer import BaseHTTPRequestHandler