Ching-Chuan Chen's Blogger

Statistics, Machine Learning and Programming

0%

Compilation of Python 3.5.5 in CentOS 7.4

簡單記錄一下在CentOS自行編譯Python 3.5.5的過程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
python_version=3.5.5
sudo yum install gcc gcc-c++
sudo yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel
sudo yum install -y wget
wget https://www.python.org/ftp/python/$python_version/Python-$python_version.tgz
tar xzf Python-$python_version.tgz
cd Python-$python_version
# 極大可能會抓不到g++,先export
export CXX=g++
./configure --prefix=/usr/local --enable-shared --enable-optimizations --enable-profiling

make -j${nproc}
sudo make altinstall
sudo tee /etc/ld.so.conf.d/local_lib.conf << EOF
/usr/local/lib
EOF
1
2
3
4
5
6
7
8
# 從Oracle官網下載Oracle Instant Client 12.2 basic, devel and sqlplus
sudo yum install oracle-instanclient12.2* -y
sudo tee /etc/ld.so.conf.d/oracle_lib.conf<< EOF
/usr/lib/oracle/12.2/client64/lib
EOF
sudo ldconfig

pip3.5 install cx_Oracle

py_main_version