Jim
Jim

Reputation: 3170

Apache Config - Multiple python versions

I have a couple versions of python on my box. My app uses python 2.7 which is found in /usr/local/bin/python. Apache seems to be using an earlier version in /usr/bin/python. How can I configure Apache to use a later version of Python for my app?

Upvotes: 2

Views: 2295

Answers (3)

user4453877
user4453877

Reputation:

To use with Python 3, you need to install the right mod_wsgi for python 3.

On Debian or Ubuntu : sudo apt-get install libapache2-mod-wsgi-py3.

For older versions of Python, when installing mod_wsgi, type : ./configure --with-python=/usr/local/bin/python2.5 for version 2.5 for instance.

Upvotes: 2

slashdot
slashdot

Reputation: 101

I could be mistaking, but whatever user apache is started with has a profile which likely has the search path in it. You could change the search path to search /usr/local/bin before /usr/bin, though this is not an ideal approach. Whatever default shell is set for the account used by Apache, just check that you have an rc-file for that shell, and if not, create one.

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798716

You can't. Either rebuild mod_wsgi against the other version of Python, or change the shebang line in your CGI scripts to the other executable.

Upvotes: 1

Related Questions