在命令提示符下我输入
python -m HTTPServer
我得到了
Serving HTTP on 0.0.0.0 port 8000
但是当我尝试访问本地主机页面时,它无法打开。
我也尝试过
http://127.0.0.1:8000/
但仍然没有任何进展。
输出:
此外,我的电脑安装了 anaconda,我认为它可能会阻碍 8000 端口。我不想卸载 anaconda。当我尝试学习 D3 时,如何使用此端口或另一个新端口?
最佳答案
使用 python3,在您的 Web Assets 目录中运行以下命令:
python -m http.server 8000
这应该相当于在 python2 中使用 SimpleHTTPServer。
关于python - 127.0.0.1 拒绝连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51809248/