python - 如何解决python(Xampp)的内部服务器错误500
问题描述
我收到此错误:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
End of script output before headers: python.py
If you think this is a server error, please contact the webmaster.
Error 500
192.168.64.2
Apache/2.4.41 (Unix) OpenSSL/1.1.1d PHP/7.4.1 mod_perl/2.0.8-dev Perl/v5.16.3
我做了以下事情:
在 httpd.conf 中将 .py 添加到 Addhandler
我做了以下事情:
在 httpd.conf 中将 .py 添加到 Addhandler
图片
我还安装了 pip 和 pymysql
我正在使用 python 3.8.3
我也将权限设置为 chmod 755
在错误日志中它说:
[Sun Jun 07 01:36:53.823419 2020] [cgi:error] [pid 847] [client 192.168.64.1:51293] AH01215: (2)No such file or directory: exec of '/opt/lampp/htdocs/11-python/python.py' failed: /opt/lampp/htdocs/11-python/python.py
[Sun Jun 07 01:36:53.824918 2020] [cgi:error] [pid 847] [client 192.168.64.1:51293] End of script output before headers: python.py
这是我的代码:
#!/usr/local/bin/python3.8
print ('Content-type: text/html\r\n')
print ('\r\n')
print ()
print ('<html>')
print ('<head>')
print ('</head>')
print ('<body>')
print ('Hello Python')
print ('</body>')
print ('</html>')
我正在使用 mac
解决方案
推荐阅读
- java - StringBuffer 会改变 JSON 的顺序吗?
- python - 过滤另一个数据框以在另一个数据框中创建新列
- java - java - 如何将输入的空值从扫描仪传递到java中的零双值?
- python - 为什么 numpy 矩阵中的变量从浮点形式变为科学形式(25 变为 2.50000e+01)
- laravel - 清除rennokki eloquent-query-cache上的缓存
- r - 通过 includeMarkdown 包含覆盖内联代码的外部 markdown 文件
- django - 在 Django ListView 中使用具有 isnull=False 和 order_by 的外键解决慢查询
- c - 从具有自己的 main() 的外部 C 文件调用函数
- amazon-web-services - AWS CloudHSM PKCS#11 与 PKCS11Interop 为 Wrap 操作 CKR_ARGUMENTS_BAD 提供错误
- jquery - 如何检查 iframe 中的选择下拉菜单是否更改?