title: Python exec() Permission Denied in Apache server: /cgi_bin/*.py
body: <p>I have 2 python env in my server. One path is <code>/usr/bin</code> and other one is the anaconda path as shown below. I am getting Permission denied error when I try executing a basic Python script on my Apache server. The python interpreter path in my .py file is as follows</p>
  
  <pre><code>#!/home/cloudera/anaconda3/bin
  </code></pre>
  
  <p>When this path is used, the apache server shows the error as shown below:</p>
  
  <blockquote>
    <p>(13)Permission denied: exec of '/var/www/cgi-bin/abc.py' failed, referer:</p>
  </blockquote>
  
  <p>When my python interpreter path in .py is changed to i.e <code>#!/usr/bin</code> it works well.</p>
  
  <p>The problem is I have installed all my packages in <code>/home/cloudera/anaconda3/bin</code> </p>
  
  <p>I tried setting this path to be accessible to execute in apache server by adding the below line of code in /etc/httpd/conf/httpd.conf file as follows</p>
  
  <pre><code>  &lt;Directory "/home/cloudera/anaconda3/bin/"&gt;
      AllowOverride None
      Options ExecCGI
      AddHandler cgi-script .py
      #None
      Order allow,deny
      Allow from all
  &lt;/Directory&gt;
  </code></pre>
  
  <p>I still get Permission Denied. It still does not work. I am new to cgi, any help would be really grateful. Thanks in advance.</p>