请问如何设置apache2让它能解释python代码?

leaof 2004-04-18 08:22:52
请问如何设置apache2让它能解释python代码?
...全文
59 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
xyzxyz1111 2004-04-19
  • 打赏
  • 举报
回复
然后
http://localhost/cgi-bin/fig06_03.py
xyzxyz1111 2004-04-19
  • 打赏
  • 举报
回复
你是不是把脚本放在APACHE的cgi-bin目录下?
leaof 2004-04-18
  • 打赏
  • 举报
回复
文件名 index.py
#!c:\Python23\python.exe
# Fig. 6.3: fig06_03.py
# Displays the current date and time in a Web browser.

print "comeing baby!"


在ie中 http://127.0.0.1

结果:
#!c:\Python23\python.exe
# Fig. 6.3: fig06_03.py
# Displays the current date and time in a Web browser.

print "comeing baby!"

根本没有解释
这是为什么?
leaof 2004-04-18
  • 打赏
  • 举报
回复
文件名 index.py
#!c:\Python23\python.exe
# Fig. 6.3: fig06_03.py
# Displays the current date and time in a Web browser.

print "comeing baby!"


在ie中 http://127.0.0.1

结果:
#!c:\Python23\python.exe
# Fig. 6.3: fig06_03.py
# Displays the current date and time in a Web browser.

print "comeing baby!"

根本没有解释
这是为什么?
xyzxyz1111 2004-04-18
  • 打赏
  • 举报
回复
CGI?
在脚本的第一行加上
#!/your/python/executable/path
就可以了

37,721

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • IT.BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧