我正在使用Head First Python开发一个简单的Webapp。我正在使用Ubuntu 14.04。但这是错误的:
Traceback (most recent call last):
File "/usr/lib/python3.4/http/server.py", line 1143, in run_cgi
os.execve(scriptfile, args, env)
FileNotFoundError: [Errno 2] No such file or directory:
'/home/sarthak/Desktop/Learn/HeadFirstPython/chapter7/webapp/cgi-bin/generate_list.py'
127.0.0.1 - - [12/Jun/2015 07:08:25] CGI script exit status 0x7f00
该文件肯定存在于系统上,并且可以执行。
如何解决问题?
问题#!/usr/local/bin/python3
出在generate_list.py文件的shebang行(第一行显示)的“错误”路径中。
如果您使用的是ubuntu,则python3的位置可能是/usr/bin/python3
(您可以通过which python3
在shell / terminal中键入来找到python3的位置)。因此,您必须将第一行调整为python3的实际地址,以使脚本正常工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句