网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

WAMP中配置python

时间:2024-11-22 13:06:13

1、找到Wamp安装目录下,apache的配置文件,并打开,如下图:

WAMP中配置python

2、到找配置文件中的以下行,把行前面的#去掉。LoadModulecgi_module modules/mod_cgi.so

WAMP中配置python

3、到找配置文件中的以下行,在FollowSymLinks后添加ExecCGI关键字OptionsIndexesFollowSymLinks

WAMP中配置python

4、到找配置文件中的以下行,#AddHandlerallows you to map certain file extensions to"handlers":把在此行下部的AddHandler cgi-script所在行,变成AddHandler cgi-script .cgi .py

WAMP中配置python

5、启动wamp。在wamp中的www目录下编写一个名为test.py的文件。内容如下(第1行指定了你的python安装所在路径,这一行不能少):#!C:\Python34\python.exeprint("Content-type:text/html\n")print("hello world")

WAMP中配置python

6、在浏览器中输入对应的URL,即可看到从python文件中输出的结果。

WAMP中配置python
© 2025 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com