通用python s

2024-05-12 20:54:50 发布

您现在位置:Python中文网/ 问答频道 /正文

当我这么做的时候

python -m SimpleHTTPServer

它在8000号港口服务。你知道吗

如何将端口更改为8000以外的端口,例如我想要8001。你知道吗

抱歉,我真的很困惑,需要完成一个项目,但我的端口8000没有更新我保存的任何文件。请帮忙。你知道吗


Tags: 文件项目端口港口simplehttpserver
3条回答

你说的更新是什么意思?这些文件托管在本地主机服务器上。你知道吗

python -m SimpleHTTPServer 8001 

您可以从终端运行SimpleHTTPServer

如果您想托管桌面的文件,那么

cd Desktop

然后呢

python -m SimpleHTTPServer 8001 

将浏览器指向本地主机:8001。你知道吗

从Python文档:

This serves the files relative to the current directory.

如果您看一下SimpleHTTPServer Documentation,它会提到如何从命令行使用模块。你知道吗

The SimpleHTTPServer module can also be invoked directly using the -m switch of the interpreter with a port number argument.

python -m SimpleHTTPServer 8000

相关问题 更多 >