首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

python的#/usr/bin/env python有关问题

2012-08-25 
python的#!/usr/bin/env python问题一般在python的文件头部加上:#!/usr/bin/env python就可以直接运行,也

python的#!/usr/bin/env python问题
一般在python的文件头部加上:

#!/usr/bin/env python

就可以直接运行,也才可以在以CGI的方式运行

我就是要以CGI的方式运行,但我的一直运行出错,表现为:
$python -m CGIHTTPServerServing HTTP on 0.0.0.0 port 8000 ...192.168.91.1 - - [20/Jun/2012 20:00:16] "GET /cgi-bin/index.py?s=11 HTTP/1.1" 200 -: No such file or directory192.168.91.1 - - [20/Jun/2012 20:00:16] CGI script exit status 0x7f00


后面看了百度好多地方,包括google,也没找到原因,直到看到这个:
http://hgoldfish.mysmth.net/2008/08/09/%E8%BF%90%E8%A1%8Clinux%E7%9A%84%E8%84%9A%E6%9C%AC%E8%80%81%E6%98%AF%E5%87%BA%E7%8E%B0-no-such-file-or-directory%E9%94%99%E8%AF%AF/

才搞定
原因居然是因为用的是windows格式的换行符,而不是unix格式的,所以。。。改成unix格式即可

热点排行