Ika*_*ari 4 python module http python-3.x
当我使用时:
>>> import http.server
Run Code Online (Sandbox Code Playgroud)
在IDLE没有任何错误.
但是当我使用这段代码时:
import http.server
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
def run(server_class = HTTPServer, handler_class = BaseHTTPRequestHandler):
server_address = ('', 8000)
httpd=server_class(server_address, handler_class)
httpd.serve_forever()
run()
Run Code Online (Sandbox Code Playgroud)
有一个错误如下:
Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 2195, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/toton/Projects/http.py", line 1, in <module>
import http.server
File "/home/toton/Projects/http.py", line 1, in <module>
import http.server
ImportError: No module named 'http.server'; 'http' is not a package
Run Code Online (Sandbox Code Playgroud)
请帮忙!
| 归档时间: |
|
| 查看次数: |
3886 次 |
| 最近记录: |