网上有很多参考,在此作为归纳和自己的笔记,欢迎指正和交流,q775915005
首先确保python的目录在系统环境变量中,如果同时有python2.和python3.版本可以将python程序改名进行区分,譬如python2的解释器程序从python.exe改为python2.exe,python3改为python3c.exe
1.在需要共享的文件夹路径输入cmd进入命令行,然后根据python2还是python3输入不同的命令
python2输入:python -m SimpleHTTPServer port_number
python3输入:python -m http.server port_number
因为我将python2程序改为python2.exe,所以对应的命令python命令改为:
python2 -m SimpleHTTPServer port_number
port_number根据自己需要设置,我设置为80,因此最后我使用的命令是:
python2 -m SimpleHTTPServer 80
或者python3c -m http.server 80