因此,我尝试在线上有关如何使用web.py的教程,并且安装了它,但不幸的是,使用这段代码会产生讨厌的错误。我的代码...
import web urls = ( '/(.*)', 'index' ) app = web.application(urls, globals()) class index: def GET(self, name): return "Hello", name, '. How are you today?' if __name__== "__main__": app.run()
我的错误:
C:\Users\User\AppData\Local\Programs\Python\Python36-32\python.exe C:/Users/User/PycharmProjects/Webprojects/main.py Traceback (most recent call last): File "C:/Users/User/PycharmProjects/Webprojects/main.py", line 15, inapp.run() File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\web\application.py", line 312, in run return wsgi.runwsgi(self.wsgifunc(*middleware)) File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\web\wsgi.py", line 59, in runwsgi return httpserver.runsimple(func, server_addr) File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\web\httpserver.py", line 154, in runsimple func = LogMiddleware(func) File "C:\Users\User\AppData\Local\Programs\Python\Python36-32\lib\site-packages\web\httpserver.py", line 296, in __init__ from BaseHTTPServer import BaseHTTPRequestHandler ModuleNotFoundError: No module named 'BaseHTTPServer' Process finished with exit code 1
小智.. 8
那进口线不会在Python 3中移动合作BaseHTTPServer
,以http.server.HTTPServer
在特定情况下,您应该将web.py更新为适用于Python 3的当前版本。
那进口线不会在Python 3中移动合作BaseHTTPServer
,以http.server.HTTPServer
在特定情况下,您应该将web.py更新为适用于Python 3的当前版本。