来自文档 :
SimpleHTTPServer
模块已合并到 Python 3.0 中的http.server
中。将源转换为 3.0 时,2to3 工具将自动调整导入。
所以,你的命令是python3 -m http.server
。
相当于:
python3 -m http.server
使用 2to3 实用程序。
$ cat try.py
import SimpleHTTPServer
$ 2to3 try.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored try.py
--- try.py (original)
+++ try.py (refactored)
@@ -1 +1 @@
-import SimpleHTTPServer
+import http.server
RefactoringTool: Files that need to be modified:
RefactoringTool: try.py