参考:https://blog.csdn.net/e_Inch_Photo/article/details/80060952
查看 python 的 http.server 模块:python -m http.server —help
PS D:\downloads> python -m http.server --help
usage: server.py [-h] [--cgi] [--bind ADDRESS] [--directory DIRECTORY] [port]
positional arguments:
port Specify alternate port [default: 8000]
optional arguments:
-h, --help show this help message and exit
--cgi Run as CGI Server
--bind ADDRESS, -b ADDRESS
Specify alternate bind address [default: all interfaces]
--directory DIRECTORY, -d DIRECTORY
Specify alternative directory [default:current directory]
PS D:\downloads>
进入对应的目录,然后运行 python -m http.server port
PS D:\downloads> python -m http.server 8010
Serving HTTP on :: port 8010 (http://[::]:8010/) ...
::1 - - [04/Mar/2022 16:21:57] "GET / HTTP/1.1" 200 -
::1 - - [04/Mar/2022 16:21:58] "GET /favicon.ico HTTP/1.1" 200 -
::ffff:10.13.30.202 - - [04/Mar/2022 16:23:32] "GET / HTTP/1.1" 200 -
::ffff:10.13.30.202 - - [04/Mar/2022 16:23:32] "GET /favicon.ico HTTP/1.1" 200 -
::ffff:10.13.30.202 - - [04/Mar/2022 16:29:24] "GET / HTTP/1.1" 200 -
::ffff:10.13.30.202 - - [04/Mar/2022 16:29:24] "GET /favicon.ico HTTP/1.1" 200 -
然后访问服务(老版的 IE 浏览器一定要输入 http://,不然不出来。。。,比如 http://10.13.30.202:8010/)
接下来,就可以进行文件下载了。