I have two python installations, one at /usr/bin/env and one through Enthought at /Library/Enthought/User/bin/python. The enthought installation has a library that I would like to use in a website that I've inherited from a former coworker.
I set up a local server through apache on my Mac OSX 10.10.5 (Yosemite). I configured httpd.conf and my user configuration file inside of the website folder to execute cgi and py files.
However, when I try to run my coworker's python scripts through the server, it seems to use the installation without the package I need (/usr/bin/env). I tried changing the shebang at the top of the script from:
'#!/usr/bin/env python' to '#!/Library/Enthought/User/bin/ python'
but that gives me an internal service error (500).
One thing I was able to do was to create a symlink using this command: 'sudo ln -s /Library/Enthought/User/bin/python /usr/bin/python'
Now his script can run and has no trouble finding the right python package. However, I'd like to understand why changing the shebang isn't enough. Why does the server still access the /usr/bin/env python distribution?
A subquestion: Lastly, I created my own test script in the meantime, but I get an Internal Service Error (500) no matter what the shebang is. This script is in the same folder as his script. Why can't this script run?:
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import cgi
import cgitb; cgitb.enable() # for troubleshooting
print "Content-type: text/html"
print
print "<html><head>"
print ""
print "</head><body>"
print "Hello."
print "</body></html>"
Thanks! I hope this question was clear. This is my first experience with web servers, so please correct me if I made any terminology mistakes!