Python <= 2.3
python -c "import SimpleHTTPServer as s; s.test();" 8000
Python >= 2.4
python -m SimpleHTTPServer 8000
Python 3.x
python -m http.server 8000
本文介绍如何使用不同版本的Python启动HTTP服务器。对于Python 2.3及以下版本, 使用`python -c import SimpleHTTPServer as s; s.test(); 8000`命令; Python 2.4及以上版本则使用`python -m SimpleHTTPServer 8000`; 而Python 3.x版本使用`python -m http.server 8000`。这些命令适用于快速搭建本地测试服务器。
Python <= 2.3
python -c "import SimpleHTTPServer as s; s.test();" 8000
Python >= 2.4
python -m SimpleHTTPServer 8000
Python 3.x
python -m http.server 8000
您可能感兴趣的与本文相关的镜像
Python3.10
Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本