mod_wsgi and multiple installations of python

后端 未结 3 1318
难免孤独
难免孤独 2020-12-06 05:10

This is kind of a continuation of this question, but it has deviated so I started a new one. I\'d like to use Python 2.5 instead of OS X\'s default 2.6. I\'ve set this up fo

3条回答
  •  悲&欢浪女
    2020-12-06 05:40

    Here is how I resolved the similar problem on CentOS 6.7, since the default was Python 2.6, I needed to install Python 2.7 to support a Django website.

    First I installed Python 2.7 with yum:

    yum install python27 python27-python-devel python27-MySQL-python
    

    the installation path of Python 2.7 is /opt/rh/python27/root/usr/bin/python

    Then we need to re-compile mod_wsgi with the new paths, and here are the commands:

    wget https://github.com/GrahamDumpleton/mod_wsgi/archive/4.4.21.tar.gz
    tar -xzf 4.4.21.tar.gz
    cd mod_wsgi-4.4.21
    ./configure --with-python=/opt/rh/python27/root/usr/bin/python LDFLAGS="-R/opt/rh/python27/root/usr/lib64"
    make  && make install
    service httpd restart
    tail /var/log/httpd/error_log
    

    The key point here is that mod_wsgi needs to locate the libpython2.7.so under /opt/rh/python27/root/usr/lib64 in my Python 2.7 installation.

    Another important note in my installation was that I had to install python27-MySQL-python with yum, otherwise I got an error when installing it with pip as below:

    pip install MySQL-python 
    

提交回复
热议问题