Do we need to install library/package for cgi to run Python scripts (on WAMP)? Or is it available automatically (in WAMP server)?
<p>I'm running Python 3.5 and I have tried installing cgi using pip and it gave me the following message:</p>

<pre><code>Could not find a version that satisfies the requirement cgi (from versions:)
No matching distribution found for cgi
</code></pre>

<p>I want to run Python scripts (locally, using WAMP server) on my browser and through some research I learned that we need to use cgi for the same. I would like to know if it is necessary to install cgi package, or is it directly available (either when Python is installed or WAMP server is installed) so that we should just configure the httpd file in the (corresponding folder in) WAMP server by adding the following code:</p>

<pre><code>AddHandler cgi-script .cgi .py
Options Indexes FollowSymLinks ExecCGI
</code></pre>

<p>Also, can we just put the Python script files in cgi-bin folder (if available) so as to execute them?</p>

<p>For CGI you dont actually need any libraries (although <a href="https://docs.python.org/3/library/cgi.html" rel="nofollow">cgi</a> from standard library is helpful) but I would strongly recommend to use WSGI as not only debugging is much easier with it. There is a <a href="https://docs.python.org/3/library/wsgiref.html#wsgiref.handlers.CGIHandler" rel="nofollow">WSGI as CGI adapter</a> in the standard library but you can also use <a href="https://code.google.com/archive/p/modwsgi/" rel="nofollow">mod_wsgi</a> for better performance.</p>

<p>There are microframeworks like <a href="http://bottlepy.org/docs/dev/index.html" rel="nofollow">bottle</a> which make building sites much easier and they work with WSGI (and therefore CGI). </p>

python apache python-3.x cgi wamp