简体   繁体   English

使用Python错误运行Web服务器

[英]Running web server using Python errors

I am using this tutorial and specifically having trouble with the part that says: 我正在使用本教程 ,尤其是遇到以下问题:

"To run a Python web server: Open up a new terminal window. Via the command line, navigate into the directory that you want served. For example, if your project folder is in your Desktop folder on your Mac, you could type: cd ~/Desktop/project-folder. Enter python -m SimpleHTTPServer 8888 &. " “要运行Python Web服务器,请执行以下操作:打开一个新的终端窗口。通过命令行,导航到要提供的目录。例如,如果项目文件夹位于Mac上的桌面文件夹中,则可以输入:cd 〜/ Desktop / project-folder。输入python -m SimpleHTTPServer 8888&。

But when I try that, it says "python" is not recognized as an internal or external command. 但是,当我尝试这样做时,它说“ python”未被识别为内部或外部命令。 Is there something I need to be adding to a PATH variable or something? 我需要添加到PATH变量中吗?

Thanks! 谢谢!

It should work on Windows just the same, try 它应该在Windows上也可以正常工作,请尝试

C:\Python27\python.exe -m SimpleHTTPServer 8888

If you want to be able to call it with simply python ... , see eg Adding Python Path on Windows 7 or Installing Python 2.7 on Windows 8 for adding Python to Windows PATH. 如果您希望能够使用简单的python ...进行调用,请参见例如在Windows 7上添加Python路径在Windows 8上安装Python 2.7,以将Python添加到Windows PATH。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM