Now, because Python 2.6 is installed and eric4 2.6 is supported, you do not want to reinstall 2.5 to configure mod_python under Apache.
Later I found an articleArticleRunning python as CGI in Apache in Windows describes how to use the CGI Mode instead of mod_python to run Python scripts. This article also describes python for Windows.
The practice is:
Open httpd. conf, find "# scriptinterpretersource Registry", and remove the comment # (if this line cannot be found, add it to it by yourself)
Find the "Options indexes followsymlinks" sentence and add "execcgi" to it. (That "indexes" is the best way to get rid of it. If no index.html file exists in the directory, all files in the directory list will be displayed. Therefore, there is a security vulnerability. If indexesis removed and no index.html file exists, a forbidden page is displayed)
Find "addhandler CGI-script. cgi" and add. py to the end. If you do not have this sentence, you can add "addhandler CGI-script. py" by yourself"
Restart Apache (sometimes restart will cause Apache to die, so in this case, you can stop and start again)
Then create a test. py script,
Print "Content-Type: text/html"
Print ""
Print "<HTML> Print "Hello World"
Print "</body>
Run the http: // localhost/test. py and hello World characters in the browser.
In addition, some error messages are as follows:
If the scriptinterpretersource registry is not added, Error 500 internal server error occurs.
If execcgi is not added, the 403 forbidden you don't have permission to access/test. py on this server will appear.
If addhandler CGI-script. py is not added, the content is displayed in the browser in text format.
Note:
The intention of adding scriptinterpretersource registry is to allow windows to use registry to find the python installation place.
Execcgi allows Python scripts to run in any directory, because Apache runs CGI scripts in the cgi-bin directory by default. When I put test. py under htdocs to run it, the 403 Forbidden problem will occur. Therefore, execcgi must be added to run. py script in htdocs. However, excecgi may have security vulnerabilities. FastCGI is safer. The premise is that FastCGI can be installed.
The CGI Mode is slower than the mod_python mode. So I will have the opportunity to try the mod_python mode on other computers in the future.