【问题标题】:How to get "python http.server" to work in Arch Linux如何让“python http.server”在 Arch Linux 中工作
【发布时间】:2015-01-30 10:33:14
【问题描述】:

当我输入“python http.server”时,我希望得到简单的网络服务器,而不是:

$ python http.server
python: can't open file 'http.server': [Errno 2] No such file or directory

在我的服务器上,还有一个 Arch 盒子(已经运行了一段时间,所以不清楚安装了哪些软件包)这个命令确实运行网络服务器。

我错过了什么?

编辑:是的,当然是“-m”,很抱歉浪费了时间,但感谢您的帮助。

【问题讨论】:

    标签: python linux python-3.x archlinux


    【解决方案1】:

    在 Python 3 上,这将运行侦听端口 9000 的服务器。

    $  python3 -m http.server 9000
    

    【讨论】:

      【解决方案2】:

      对于 Python2,我相信您正在寻找的命令是

       python -m SimpleHTTPServer
      

      如果你有python3,那么this documentation建议你需要

       python3 -m http.server
      

      【讨论】:

        猜你喜欢
        • 2014-06-02
        • 1970-01-01
        • 2021-03-21
        • 2016-08-22
        • 1970-01-01
        • 2013-03-02
        • 2023-03-22
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多