如何在centos7,Apache/2.4.6下使用Python3.5.2编译mod_wsgi 4.5.3 [英] How to compile mod_wsgi 4.5.3 with Python3.5.2 under centos7, Apache/2.4.6
问题描述
我尝试对mod_wsgi 4.5.3进行./configure,如下所示:
I tried ./configure for mod_wsgi 4.5.3 like below:
./configure --with-python =/opt/Python352/bin
./configure --with-python=/opt/Python352/bin
/opt/Python352文件夹与python3.5.2.一起安装的地方.
Where /opt/Python352 folder is installed with python3.5.2.
但是,在CentOS 7中,配置"始终使用二进制"python"(对应于python2.75)而不是二进制"python3"或"python3.5"来构建mod_wsgi.
However in CentOS 7 the "configure" always builds the mod_wsgi with binary "python"(corresponding to python2.75) not with binary "python3" or "python3.5".
要求是获取.so文件,该文件是mod_wsgi 4.5.3的最新文件,该文件使用python3.5.2编译,并在CentOS 7下的Apache/2.4.6中加载.
Requirement is to get the .so file, the latest for mod_wsgi 4.5.3, compiled using python3.5.2 and load this in Apache/2.4.6 under CentOS 7.
谢谢.
推荐答案
以下是我用于CentOS 7.2的确切转储.您可能不需要很多先决条件,但我认为我会把它们包括在内,因为许多先决条件很方便:
Here's an exact dump of what I use for CentOS 7.2. You can probably do without a lot of the pre-reqs, but I figured I'd include them since many are handy to have:
echo 'Python 3.5.2 is not installed, installing Python 3 pre-requisites...'
yum -y groupinstall development
echo 'Installing extra packages for Python...'
yum -y install zlib-devel openssl-devel sqlite-devel bzip2-devel python-devel openssl-devel libffi-devel openssl-perl libjpeg-turbo-devel zlib-devel giflib ncurses-devel gdbm-devel xz-devel tkinter readline-devel tk tk-devel
echo 'Installing Python 3.5.2...'
wget -q 'https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz'
tar -xzf 'Python-3.5.2.tgz'
cd ./Python-3.5.2
CXX=g++ ./configure --enable-shared
make
echo 'Moving to alternate location to keep system Python version intact...'
make altinstall
cd ..
rm Python-3.5.2.tgz
rm -rf ./Python-3.5.2
ln -fs /usr/local/bin/python3.5 /usr/bin/python3.5
echo "/usr/local/lib/python3.5" > /etc/ld.so.conf.d/python35.conf
echo "/usr/local/lib" >> /etc/ld.so.conf.d/python35.conf
ldconfig
echo 'Now, install mod_wsgi...'
wget -q "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=/usr/local/bin/python3.5
make
make install
鉴于所提供的信息,我看不到您的问题有明显的问题,但想出一个完整的工作示例将有所帮助.
I couldn't see an obvious problem with your question given the information, but figured a complete working example would help.
这篇关于如何在centos7,Apache/2.4.6下使用Python3.5.2编译mod_wsgi 4.5.3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!