This is a repo for compilling and installing Python from scratch
-
sudo apt-get update -
sudo apt-get install build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev -
go to python.org and get the latest prod release. I'll just use "Python 3.10.5" for now
-
Copy link address of "Gzipped source tarball"
-
wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
-
tar zxvf Python-3.10.5.tgzto uncompress the file -
rm Python-3.10.5.tgzsince it's no longer needed -
cd Python-3.10.5 -
./configure --enable-optimizationsto configure optimizations, it creates the makefile -
make -j 4I have 4 cores in the Github Codespace instance, to compile on all 8 cores -
sudo make altinstall, after this - Python is installed -
python- You'll see the system python is still there, not the one we just installed -
/usr/local/bin/python3.10- will allow us to use it, however, on a new terminal session, it goes away
13b) To make it permanent on every new terminal session - nano ~/.bashrc
At the end of the bashrc file, add the below
#new python
alias python="/usr/local/bin/python3.10"
-
source ~/.bashrc- to activate or refresh the bashrc -
Type
pythonagain to confirm - voila! -
Create a virtual environment -
python -m venv ~/.venv -
Go back to bashrc file -
nano ~/.bashrc -
Add the below to the file
source ~/.venv/bin/activate
-
Run step 14 again - voila! - Always in your virtual environment with your newly installed python
-
sudo apt-get update -
sudo apt-get install build-essential gdb lcov libbz2-dev libffi-dev libgdbm-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev -
go to python.org and get the latest prod release. I'll just use "Python 3.10.5" for now
-
Copy link address of "Gzipped source tarball"
-
wget https://www.python.org/ftp/python/3.10.5/Python-3.10.5.tgz
-
tar zxvf Python-3.10.5.tgzto uncompress the file -
rm Python-3.10.5.tgzsince it's no longer needed -
cd Python-3.10.5 -
./configure --enable-optimizationsto configure optimizations, it creates the makefile -
make -j 4I have 4 cores in the Github Codespace instance, to compile on all 8 cores -
sudo make altinstall, after this - Python is installed -
python- You'll see the system python is still there, not the one we just installed -
/usr/local/bin/python3.10- will allow us to use it, however, on a new terminal session, it goes away
13b) To make it permanent on every new terminal session - nano ~/.bashrc
At the end of the bashrc file, add the below
#new python
alias python="/usr/local/bin/python3.10"
-
source ~/.bashrc- to activate or refresh the bashrc -
Type
pythonagain to confirm - voila! -
Create a virtual environment -
python -m venv ~/.venv -
Go back to bashrc file -
nano ~/.bashrc -
Add the below to the file
source ~/.venv/bin/activate
-
Run step 14 again - voila! - Always in your virtual environment with your newly installed python
-
Might as well build out the whole scaffold
touch requirements.txttouch Makefile
-
Could even install github copilot extension just for the project being worked on
-
git status