my Python 3.8.1 build script on CentOS 7
#!/bin/bash | |
# original source/tip: https://www.workaround.cz/howto-compile-install-latest-python-37-38-centos-7-8/ | |
wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz -P /tmp/ | |
tar xzfv /tmp/Python-3.8.1.tgz -C /tmp | |
cd /tmp/Python-3.8.1 | |
# https://blog.csdn.net/whatday/article/details/103903955 | |
# https://bugs.python.org/msg313644 | |
# https://github.com/docker-library/python/issues/160#issuecomment-273371334 | |
sudo ./configure --enable-shared --enable-optimizations \ | |
--prefix=/opt/python381 \ | |
LDFLAGS="-Wl,-rpath=/opt/python381/lib -Wl,-Bsymbolic-functions -Wl,-z,relro" \ | |
--with-computed-gotos --with-system-ffi --with-fpectl \ | |
--with-system-libmpdec --with-lto | |
sudo make -j `nproc` | |
sudo make altinstall | |
sudo rm /tmp/Python-3.8.1.tgz | |
# this section I did manually because I want to see if build works | |
sudo ln -s /opt/python381/bin/python3.8 /opt/python381/bin/python3 | |
sudo ln -s /opt/python381/bin/python3.8 /opt/python381/bin/python | |
sudo ln -s /opt/python381/bin/python3.8 /usr/bin/python381 | |
sudo ln -s /opt/python381/bin/pip3.8 /opt/python381/bin/pip3 | |
sudo ln -s /opt/python381/bin/pip3.8 /opt/python381/bin/pip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment