Python 3 http.server 语法错误 [英] Python 3 http.server syntax error
本文介绍了Python 3 http.server 语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试建立我的第一个简单的 Python http 服务器.这是我尝试过的.请帮忙.
Hi I try to set up my first simple Python http server. This is what I tried. Please help.
>>>import os
>>>os.chdir('/users/ds/my documents/pythonservers/frenchacademy')
>>>os.getcwd()
'C:\\users\\ds\\my documents\\pythonservers\\frenchacademy'
>>> python -m SimpleHTTPServer
SyntaxError: invalid syntax
>>> python -m SimpleHTTPServer 8000
SyntaxError: invalid syntax
>>> -m SimpleHTTPServer
SyntaxError: invalid syntax
>>> python -m http.server
SyntaxError: invalid syntax
>>> -m http.server
SyntaxError: invalid syntax
>>> --version
Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
--version
NameError: name 'version' is not defined
>>> python --version
Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
python --version
NameError: name 'python' is not defined
>>> $ python -m http.server
SyntaxError: invalid syntax
>>> python3 -m http.server
SyntaxError: invalid syntax
>>> -m http.server
SyntaxError: invalid syntax
>>> python3 -m http.server --help
SyntaxError: invalid syntax
推荐答案
资助解决方案.通常是一个愚蠢的错误.我不得不将命令放在 windows 命令行中,而不是在 python 中.
Fund the solution. As usually a stupid error. I had to put the command in the windows command line and not in python itself.
这篇关于Python 3 http.server 语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文