Numpy 和 CGI 的问题
我决定创建一个项目,对用户的给定输入执行计算。
我安装了Python 2.7.2和Numpy 1.6.1。我正在运行安装了 apache2 的 Ubuntu 11.10 64 位。我的 .cgi 文件位于 /usr/lib/cgi-bin 中。 第一个脚本 math.cgi 如下所示:
#!/usr/bin/python
from numpy import *
from numpy.linalg import *
b = array([9,8])
a = array([[3,1], [1,2]])
x = solve(a,b)
print x
我可以通过在 /usr/lib/cgi-bin 中键入 python math.cgi 来运行它并获得正确的输出。我使用了 chmod +x math.cgi。但是当我看一下 http://127.0.1.1/cgi-bin/math.cgi< /a> 我收到内部服务器错误 500。
有谁知道我需要修复什么,例如 http://127.0.1.1/cgi-bin/math.cgi 也会给出正确的输出?
I decided to create a project which performs computation on a given input of the user.
I installed Python 2.7.2 and Numpy 1.6.1. I'm running Ubuntu 11.10 64bit with apache2 installed. My .cgi files are placed in /usr/lib/cgi-bin.
The first script math.cgi looks as follows:
#!/usr/bin/python
from numpy import *
from numpy.linalg import *
b = array([9,8])
a = array([[3,1], [1,2]])
x = solve(a,b)
print x
I can run it by typing python math.cgi in /usr/lib/cgi-bin and get the correct output. I used chmod +x math.cgi. But when I take a look at http://127.0.1.1/cgi-bin/math.cgi I get an Internal Server Error 500.
Does anyone have an idea what I need to fix, such that http://127.0.1.1/cgi-bin/math.cgi will also give the correct output?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须先打印标题,例如此处所述
You have to print the header first, such as described here