Last active
July 5, 2022 18:32
-
-
Save Iftakharpy/270965162000ccc94007def11a16e73c to your computer and use it in GitHub Desktop.
Build python3 from source on Linux OS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install build-essential build-dep python gdb lcov pkg-config libpq-dev \ | |
libbz2-dev libffi-dev libgdbm-dev libnss3-dev libgdbm-compat-dev liblzma-dev \ | |
libncurses5-dev libreadline6-dev libreadline-dev libsqlite3-dev libssl-dev \ | |
lzma lzma-dev tk-dev uuid-dev zlib1g-dev wget | |
# download latest python source code | |
wget https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tgz | |
# unzip the source code | |
tar -xf Python-3.10.4.tgz | |
# build and install | |
cd Python-3.10.4/ | |
./configure --enable-optimizations | |
# following command will install python as second instance of Python | |
sudo make altinstall | |
# following command will overwrite the default python installation if there is any | |
sudo make install | |
# if all went well this should return the latest installed python version | |
python3.10 --version | |
sudo apt-get python3-pip # install package manager | |
# To fix error no module named 'six' | |
pip3 install six |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment