簡體   English   中英

ValueError:使用python3 -m http.server --cgi 8000時以int()為基數為10的int()無效文字:'--cgi'

[英]ValueError: invalid literal for int() with base 10: '--cgi' when using python3 -m http.server --cgi 8000

當我運行python3 -m http.server --cgi 8000時說:

Traceback (most recent call last):
  File "/usr/lib/python3.2/runpy.py", line 160, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python3.2/runpy.py", line 73, in _run_code
    exec(code, run_globals)
  File "/usr/lib/python3.2/http/server.py", line 1187, in <module>
    test(HandlerClass=SimpleHTTPRequestHandler)
  File "/usr/lib/python3.2/http/server.py", line 1169, in test
    port = int(sys.argv[1])
ValueError: invalid literal for int() with base 10: '--cgi'

看起來--cgi標志僅在python 3.3中添加。 您正在使用python 3.2,它希望唯一的參數是端口號。

解決方法似乎是升級到python 3.3或不使用--cgi。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM