Apache Config - Multiple python versions

后端 未结 3 440
名媛妹妹
名媛妹妹 2021-01-15 11:09

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.

相关标签:
3条回答
  • 2021-01-15 11:30

    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.

    0 讨论(0)
  • 2021-01-15 11:35

    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.

    0 讨论(0)
  • 2021-01-15 11:51

    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.

    0 讨论(0)
提交回复
热议问题