On an RHEL6 system, I'd like my postGIS implementation (ie my postgres/postgresql databases) to use Enthought's Canopy distribution of python, rather than the built-in GNU's distribution. (This is because postGIS needs some packages that seem hard to install from RHEL's built-in repositories.)

How can I change the python path / etc just for postgres?


There are a couple of methods to try.

Override stop/start script

In the stop/start script for PostgresSQL I would add the path to this custom version of Python. The start/stop script is here, for example: /etc/init.d/postgresql. If you add a line towards the top of this script:

export PATH=/path/to/postGIS/python:$PATH

You'll override the location that Python is used from.

Add a customization vis sysconfig

Most Red Hat services will look in the directory /etc/sysconfig for additional customizations. You could try adding the custom PATH there instead.

Create a file like this: /etc/sysconfig/pgsql/mycustompath.bash, and add the following line to it (you might need other entries as well):

export PATH=/path/to/postGIS/python:$PATH


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.