INSTALLING PYTHON 3.9.6 ON AWS LINUX 2 - The Easiest Way
This video shows you how to install Python 3.9.6 on Amazon Linux 2. The steps are ; Step 1 – Install GCC Command: sudo yum install gcc openssl-devel bzip2-devel libffi-devel Step 2 – Download Python 3.9 Visit Python official download page and download the required Python on your system. Alternatively, You can use the following command to download Python 3.9 on a local machine. cd /opt sudo wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz After the download is finished, extract the archive file. sudo tar xzf Python-3.9.6.tgz Step 3 – Install Python 3.9 -- Use the below set of commands to compile Python 3.9 from the source code and install using the altinstall command. cd Python-3.9.6 sudo ./configure --enable-optimizations sudo make altinstall -- make altinstall is used to prevent replacing the default python binary file /usr/bin/python. -- Now remove the downloaded source archive file from your system sudo rm -f /opt/Python-3.9.6.tgz Step 4 – Check Python Version The Python 3.9 binary is installed under /usr/local/bin directory. As we have not overwritten the current Python version, you need to run Python 3.9 command as following: python3.9 -V Step 5 – Create Python Virtual Environment Python provides to create an isolated environment for the applications. Where you can create an environment directory with a specific Python version. This will contains application-specific packages. Use the following command to create environment directory: python3.9 -m venv env The above command will create a directory “env” in the current directory containing all the required files for the isolated environment. Every time you need to make changes in the environment, Use the below command to active it. source env/bin/activate After activating the environment, you can work with your application. Once your work is finished, use the following command to deactivate the Python environment. deactivate
This video shows you how to install Python 3.9.6 on Amazon Linux 2. The steps are ; Step 1 – Install GCC Command: sudo yum install gcc openssl-devel bzip2-devel libffi-devel Step 2 – Download Python 3.9 Visit Python official download page and download the required Python on your system. Alternatively, You can use the following command to download Python 3.9 on a local machine. cd /opt sudo wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz After the download is finished, extract the archive file. sudo tar xzf Python-3.9.6.tgz Step 3 – Install Python 3.9 -- Use the below set of commands to compile Python 3.9 from the source code and install using the altinstall command. cd Python-3.9.6 sudo ./configure --enable-optimizations sudo make altinstall -- make altinstall is used to prevent replacing the default python binary file /usr/bin/python. -- Now remove the downloaded source archive file from your system sudo rm -f /opt/Python-3.9.6.tgz Step 4 – Check Python Version The Python 3.9 binary is installed under /usr/local/bin directory. As we have not overwritten the current Python version, you need to run Python 3.9 command as following: python3.9 -V Step 5 – Create Python Virtual Environment Python provides to create an isolated environment for the applications. Where you can create an environment directory with a specific Python version. This will contains application-specific packages. Use the following command to create environment directory: python3.9 -m venv env The above command will create a directory “env” in the current directory containing all the required files for the isolated environment. Every time you need to make changes in the environment, Use the below command to active it. source env/bin/activate After activating the environment, you can work with your application. Once your work is finished, use the following command to deactivate the Python environment. deactivate