Python3 – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Mon, 09 Jan 2023 09:50:01 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Install Python3 on Pop!_OS {3 Methods} https://tecadmin.net/how-to-install-python3-on-popos/ https://tecadmin.net/how-to-install-python3-on-popos/#respond Mon, 09 Jan 2023 09:50:01 +0000 https://tecadmin.net/?p=33356 Pop!_OS is a popular operating system based on Ubuntu, and like most operating systems, it comes with a default version of Python installed. However, you may want to install a newer version of Python or multiple versions of Python on your system for different purposes. Python is a popular programming language that is widely used [...]

The post How to Install Python3 on Pop!_OS {3 Methods} appeared first on TecAdmin.

]]>
Pop!_OS is a popular operating system based on Ubuntu, and like most operating systems, it comes with a default version of Python installed. However, you may want to install a newer version of Python or multiple versions of Python on your system for different purposes.

Python is a popular programming language that is widely used in many fields, including data science, web development, and scientific computing. Pop!_OS is a popular operating system based on Ubuntu, and like most operating systems, it comes with a default version of Python installed. However, you may want to install a newer version of Python or multiple versions of Python on your system for different purposes.

In this article, we will explore three methods for installing Python 3 on Pop!_OS: using the Pop!_OS package manager, using `deadsnakes` PPA, and building Python from the source.

Method 1 – Using default package manager

Pop!_OS comes with a package manager called “apt” (Advanced Package Tool) that allows you to install and manage software packages. To install the latest version of Python using apt, you can use the following command:

sudo apt install python3 

This will install Python 3 and its associated package manager “pip3” (Python Package Index), which you can use to install additional Python packages.

Method 2 – Using PPA (Personal Package Archive)

To install Python 3 on Pop!_OS using a Personal Package Archive (PPA), you can follow these steps:

  1. Open a terminal and update the package and install the software-properties-common package, which provides the “add-apt-repository” command that you will use to add the PPA:
    sudo apt update && sudo apt install software-properties-common -y
    
  2. Add the `deadsnakes` PPA, which provides updated versions of Python:
    sudo add-apt-repository ppa:deadsnakes/ppa 
    
  3. Update the package list again to include the packages in the PPA and then install Python 3 using the apt package manager:
    sudo apt update && sudo apt install python3.11 
    

    Replace “3.11” with the desired version of Python.

  4. Verify that Python 3 was installed correctly by running the following command:
    python3 --version 
    

    You should see the version of Python that you installed.

Note that using a PPA is not the recommended method for installing Python on Pop!_OS, as it can introduce compatibility issues and security risks. It is generally better to use the package manager or Anaconda distribution to install Python.

Method 3 – Building Python from source

If you want to install a specific version of Python or customize your Python installation, you can build Python from source. To do this, you will need to download the source code from the Python website (https://www.python.org/downloads/) and follow the instructions in the “Building Python from source” section of the documentation (https://docs.python.org/3/using/unix.html#building-python).

  1. Download the required Python version
    https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tgz 
    
  2. Extract the downloaded archive file
    tar xzf Python-3.11.1.tgz -C /usr/src 
    
  3. Switch to the extracted directory
    cd /usr/src/Python3.11.1 
    
  4. Build the Python source code and install it.
    ./configure 
    make 
    make install 
    
  5. Once the build and installation are completed successfully, verify the installed Python version.
    python3.11 --version 
    

Building Python from source can be a more advanced option, as it requires you to have a compiler and other dependencies installed on your system.

Regardless of which method you choose, it is important to note that Python 2 is no longer actively developed and it is recommended to use Python 3 for all new projects.

Conclusion

In this article, we have discussed three methods for installing Python 3 on Pop!_OS: using the Pop!_OS package manager, using the Anaconda distribution, and building Python from the source. Each method has its own advantages and drawbacks, and the appropriate method will depend on your specific needs and preferences. Using the Pop!_OS package manager or Anaconda distribution is generally the easiest and most reliable way to install Python while building Python from source allows for more customization and control.

Regardless of which method you choose, it is important to note that Python 2 is no longer actively developed and it is recommended to use Python 3 for all new projects.

The post How to Install Python3 on Pop!_OS {3 Methods} appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python3-on-popos/feed/ 0
How To Install Python 3.10 on Debian 11/10 https://tecadmin.net/how-to-install-python-3-10-on-debian-11/ https://tecadmin.net/how-to-install-python-3-10-on-debian-11/#comments Sat, 12 Feb 2022 06:33:41 +0000 https://tecadmin.net/?p=28521 The Python development team has released the latest version of Python 3.10. This includes more new features, security patches, and many other improvements. This version includes a new feature that is “Parenthesized context managers”. Using enclosing parentheses for continuation across multiple lines in context managers is now supported. For more details read the complete changelog. [...]

The post How To Install Python 3.10 on Debian 11/10 appeared first on TecAdmin.

]]>
The Python development team has released the latest version of Python 3.10. This includes more new features, security patches, and many other improvements. This version includes a new feature that is “Parenthesized context managers”. Using enclosing parentheses for continuation across multiple lines in context managers is now supported. For more details read the complete changelog.

This tutorial will help you with the installation of Python 3.10 on Debian 11 & Debian 10 Linux systems. The tutorial will compile and install Python 3.10 source code on your system.

Prerequisites

First of all, Log in to your Debian-based system with sudo privileged account access. Open a terminal (CTRL+ALT+T) and execute the below commands to update packages.

sudo apt update && sudo apt upgrade 

Then install the required packages for the compilation of Python source code.

sudo apt install wget build-essential libncursesw5-dev libssl-dev \
     libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev  

Install Python 3.10 on Debian

The default Debian repositories contain older Python versions only. So this tutorial will use Python source code for installation on Debian 10 system.

Follow the below steps to install Python 3.10 on Debian:

  1. Download Python – You can directory download Python 3.10 source archive from its official site.
    wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz 
    
  2. Extract Archive – After downloading, extract the archive file on your system.
    tar xzf Python-3.10.8.tgz 
    
  3. Compiling Python Source – Change to the extracted directory with cd command, then prepare the Python source code for the compilation on your system.
    cd Python-3.10.8 
    ./configure --enable-optimizations 
    
  4. Install Python 3.10 – Finally, run the following command to complete the Python installation on Debian system. The altinstall prevents the compiler to override default Python versions.
    make altinstall 
    

Wait for the Python installation to complete on your system.

Check Python Version

At this step, you have successfully installed Python 3.9 on Debian 10 system. You need to type python3.9 to use this version. For example, to check the Python version, execute:

python3.10 -V 

Python 3.10.8

This will also install pip for Python 3.10.

pip3.10 -V 

pip 21.2.4 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

That’s it, You have successfully installed Python 3.10 on Debian 11 and Debian 10 systems.

Conclusion

In this tutorial, you have learned to install Python 3.10 on Debian Linux systems using source code. You can try Python examples via command line.

The post How To Install Python 3.10 on Debian 11/10 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python-3-10-on-debian-11/feed/ 1
How to Install Python 3.10 on CentOS/RHEL 8 & Fedora 36/35 https://tecadmin.net/how-to-install-python-3-10-on-centos-rhel-8-fedora/ https://tecadmin.net/how-to-install-python-3-10-on-centos-rhel-8-fedora/#comments Sat, 12 Feb 2022 06:05:00 +0000 https://tecadmin.net/?p=28517 The Python development team has released the latest version of Python 3.10. This includes more new features, security patches, and many other improvements. This version includes a new feature that is Parenthesized, context managers. Using enclosing parentheses for continuation across multiple lines in context managers is now supported. For more details read the complete changelog. [...]

The post How to Install Python 3.10 on CentOS/RHEL 8 & Fedora 36/35 appeared first on TecAdmin.

]]>
The Python development team has released the latest version of Python 3.10. This includes more new features, security patches, and many other improvements. This version includes a new feature that is Parenthesized, context managers. Using enclosing parentheses for continuation across multiple lines in context managers is now supported. For more details read the complete changelog.

This tutorial will help you with the installation of Python 3.10 on all Fedora versions and CentOS/RHEL 8 Linux systems. The tutorial will compile and install Python 3.10 source code on your system.

Prerequisites

The system must have a pre-installed GCC compiler on your system. In order to install all required packages, Login to your server using ssh or shell access, and execute the following command to install all prerequisites for Python.

sudo dnf install wget yum-utils make gcc openssl-devel bzip2-devel libffi-devel zlib-devel 

Step 1 – Download Python 3.10 Source Code

The first step is to download the Python 3.10 source code. Visit the official download site https://www.python.org/ftp/python to download the latest or required version of the Python.

Command line users can download Python 3.10 via the command line:

wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz 

Then, extract the archive file from your system

tar xzf Python-3.10.8.tgz 

This will create a directory named Python-3.10.8 in the current directory containing all source files for Python 3.10.

Step 2 – Installing Python 3.10 on Fedora/CentOS

Change the directory to Python-3.10.8. Then prepare the source code with the required values before compiling it.

cd Python-3.10.8 
sudo ./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions 

Next, compile the source code with make. Here nproc will provide the number of CPU cores available on system. So that make can perform well.

sudo make -j ${nproc} 
sudo make altinstall 
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Now, we don’t need the downloaded archive file, so delete it to free space.

sudo rm Python-3.10.8.tgz 

Step 3 – Test Python Version

At this step, you have successfully installed Python 3.10 on Fedora or CentOS/RHEL system. Now, check the installed versions of Python and PIP.

Check Python Version:

python3.10 -V  

Python 3.10.8

Check PIP Version:

pip3.10 -V  

pip 20.2.3 from /usr/local/lib/python3.10/site-packages/pip (python 3.10)

Step 4 – Create Virtual Environment

It is a good idea to create a separate virtual environment for each Python application. Which provides an isolated environment where the Python project has its own modules and set of dependencies.

To create Python virtual environment, run:

cd ~/python-app/ 
sudo /usr/local/bin/python3.10 -m venv appenv 

Here ~/python-app is containing the Python application. All the env files will be generated under ~/python-app/appenv directory. You can active the environment by running command:

source appenv/bin/activate 

Do your stuff in an isolated environment here. Once you finish with your work, deactivate the environment by typing:

deactivate 

This will return you back to the main system prompt.

Conclusion

This tutorial described you to install Python 3.10 on Fedora and CentOS/RHEL 8 systems using the source code.

The post How to Install Python 3.10 on CentOS/RHEL 8 & Fedora 36/35 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python-3-10-on-centos-rhel-8-fedora/feed/ 4
How To Install Python 3.9 on Ubuntu, Debian & LinuxMint https://tecadmin.net/how-to-install-python-3-9-on-ubuntu-debian-linuxmint/ https://tecadmin.net/how-to-install-python-3-9-on-ubuntu-debian-linuxmint/#comments Mon, 01 Mar 2021 17:27:51 +0000 https://tecadmin.net/?p=24871 Python is an object-oriented, high-level programming language. The Python 3.9 stable version has been released with several improvements and security updates. Which included multiple new modules and improved existing modules and new features. As of today, Python 3.9 is the latest stable version available for productions environments. Most of the Debian-based Linux distribution includes older [...]

The post How To Install Python 3.9 on Ubuntu, Debian & LinuxMint appeared first on TecAdmin.

]]>
Python is an object-oriented, high-level programming language. The Python 3.9 stable version has been released with several improvements and security updates. Which included multiple new modules and improved existing modules and new features.

As of today, Python 3.9 is the latest stable version available for productions environments. Most of the Debian-based Linux distribution includes older versions of Python in software repositories. Also, the Debian packages are not available for all distributions. In this tutorial, you will learn to compile Python 3.9 from source code and install it on Debian-based systems.

This tutorial will help you to how to install Python 3.9 on Ubuntu, Debian, and LinuxMint systems using source code.

Prerequisites

Login to the Debian system with sudo privileged account access. Open a terminal (CTRL+ALT+T) and execute the below commands to update packages.

sudo apt update && sudo apt upgrade 

Then install the required packages for the compilation of Python source code.

sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev \
     libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev  

Installing Python 3.9 with Source

Download the latest Python version source code from the official websites. Then compile the source code for your system and install it.

Follow the below steps to install Python 3.9 on Debian systems:

  1. You can directory download Python 3.9 source archive from its official site or use below command.
    wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz 
    
  2. Once the download is completed, extract the archive file on your system.
    tar xzf Python-3.9.7.tgz 
    
  3. Change to the extracted directory with cd command, then prepare the Python source code for the compilation on your system.
    cd Python-3.9.7 
    ./configure --enable-optimizations 
    
  4. Finally, run the following command to complete the Python installation on the Debian system. The altinstall prevents the compiler to override default Python versions.
    make altinstall 
    

Wait for the Python installation to complete on your system.

Check Python Version

At this step, you have successfully installed Python 3.9 on Debian 10 system. You need to type python3.9 to use this version. For example, to check the Python version, execute:

python3.9 -V 

Python 3.9.7

This will also install pip for Python 3.9.

pip3.9 -V 

pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

That’s it, You have successfully installed Python 3.9 on Debian 10 system.

Conclusion

In this tutorial, you have learned to install Python 3.9 on Ubuntu, Debian, and LinuxMint systems using source code. You can try Python examples via command line.

The post How To Install Python 3.9 on Ubuntu, Debian & LinuxMint appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python-3-9-on-ubuntu-debian-linuxmint/feed/ 5
How To Install Python 3.9 on Debian 10 https://tecadmin.net/how-to-install-python-3-9-on-debian-10/ https://tecadmin.net/how-to-install-python-3-9-on-debian-10/#comments Sun, 20 Dec 2020 05:59:43 +0000 https://tecadmin.net/?p=24190 Python is an object-oriented, high-level programming language. It is open-source with a large community. Python is used as a key language among the top tech companies like Google. The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules, and many other features. Debian [...]

The post How To Install Python 3.9 on Debian 10 appeared first on TecAdmin.

]]>
Python is an object-oriented, high-level programming language. It is open-source with a large community. Python is used as a key language among the top tech companies like Google. The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules, and many other features.

Debian 10 default repositories come with Python 3.7. So if your application can work with this version, install it from default repositories using command apt install python3 . To install Python 3.9 on Debian 10 follow this tutorial.

This tutorial will describe you install Python 3.9 on Debian 10 Linux system.

Prerequisites

Login to the Debian system with sudo privileged account access. Open a terminal (CTRL+ALT+T) and execute the below commands to update packages.

sudo apt update && sudo apt upgrade 

Then install the required packages for the compilation of Python source code.

sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev \
     libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev  

Install Python 3.9 on Debian

The default Debian repositories contain Python 3.7 only. So this tutorial will use Python source code for installation on Debian 10 system.

Follow the below steps to install Python 3.9 on Debian:

  1. Download Python – You can directory download Python 3.9 source archive from its official site.
    wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz 
    
  2. Extract Archive – After downloading, extract the archive file on your system.
    tar xzf Python-3.9.6.tgz 
    
  3. Compiling Python Source – Change to the extracted directory with cd command, then prepare the Python source code for the compilation on your system.
    cd Python-3.9.6 
    ./configure --enable-optimizations 
    
  4. Install Python 3.9 – Finally, run the following command to complete the Python installation on Debian system. The altinstall prevents the compiler to override default Python versions.
    make altinstall 
    

Wait for the Python installation to complete on your system.

Check Python Version

At this step, you have successfully installed Python 3.9 on Debian 10 system. You need to type python3.9 to use this version. For example, to check the Python version, execute:

python3.9 -V 

Python 3.9.6

This will also install pip for Python 3.9.

pip3.9 -V 

pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

That’s it, You have successfully installed Python 3.9 on Debian 10 system.

Conclusion

In this tutorial, you have learned to install Python 3.9 on Debian Linux systems using source code. You can try Python examples via command line.

The post How To Install Python 3.9 on Debian 10 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python-3-9-on-debian-10/feed/ 3
How to Install Python 3.9 on Debian 9 https://tecadmin.net/how-to-install-python-3-9-on-debian-9/ https://tecadmin.net/how-to-install-python-3-9-on-debian-9/#comments Thu, 10 Dec 2020 06:20:35 +0000 https://tecadmin.net/?p=24199 Python is an object-oriented, high-level programming language. It is an open source with a large community. Python is used as key languages among the top tech companies like Google. The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules and many other features. [...]

The post How to Install Python 3.9 on Debian 9 appeared first on TecAdmin.

]]>
Python is an object-oriented, high-level programming language. It is an open source with a large community. Python is used as key languages among the top tech companies like Google. The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules and many other features.

The Debian 9 stretch comes with default Python 2.7 and 3.5. So you can install Python 3.5 directly from the default apt repositories using command apt install python3 . If you still need to install Python 3.9 on Debian 9, Go ahead with this tutorial.

This tutorial will describe you to how to install Python 3.9 on Debian 9 Stretch Linux system.

Prerequisites

Firstly, login to your Debian 9 system with sudo user. After login, update the current packages on your system to update packages.

sudo apt update && sudo apt upgrade 

After that, install belwo packages on your system, which is required for the installation of Python 3.9 from source code.

sudo apt install wget build-essential libreadline-gplv2-dev libncursesw5-dev \
     libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev  

Installing Python 3.9 on Debian

As you know, the default apt repositories contains Python 3.5 only. So to install latest packages, you need to compile it from source code. Use below steps to install Python 3.9 on Debian Stretch systems.

  1. Download Python – Download the Python 3.9 source code archive from its official website. alternatively use below wget command to download Python source code.
    wget https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz 
    
  2. Extract Archive – Next, extract the download archive file using the tar command. If required change your directory before extract.
    tar xzf Python-3.9.4.tgz 
    
  3. Compile Python Source – Switch to the extracted directory and configure the source code with enabling optimizations.
    cd Python-3.9.4 
    ./configure --enable-optimizations 
    
  4. Install Python 3.9 – Finally, run the make command to complete the Python installation. Here altinstall option is to install Python separately than default versions.
    make altinstall 
    

Wait for the Python installation complete on your system. All done.

Check Python Version

At this step, you have successfully installed Python 3.9 on Debian system. You need to type python3.9 to use this version. For example, to check the Python version, execute:

python3.9 -V 

Python 3.9.4

This will also install pip for Python 3.9.

pip3.9 -V 

pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

That’s it, You have successfully installed Python 3.9 on Debian 9 (Stretch) Linux system.

Conclusion

This tutorial described you to install Python 3.9 on Debian Linux systems using source code. You can try Python examples via command line.

The post How to Install Python 3.9 on Debian 9 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python-3-9-on-debian-9/feed/ 5
How to Install Python 3.9 on CentOS/RHEL 8 https://tecadmin.net/install-python-3-9-on-centos-8/ https://tecadmin.net/install-python-3-9-on-centos-8/#comments Mon, 30 Nov 2020 17:59:09 +0000 https://tecadmin.net/?p=23473 Recently, the Python development team released the latest stable version of Python 3.9. You can download it from its official pages. The new version comes with multiple new features and security updates. Python 3.9 uses a new more flexible parser, based on PEG, which replaces the LL parser. In the next Python versions, the old [...]

The post How to Install Python 3.9 on CentOS/RHEL 8 appeared first on TecAdmin.

]]>
Recently, the Python development team released the latest stable version of Python 3.9. You can download it from its official pages. The new version comes with multiple new features and security updates. Python 3.9 uses a new more flexible parser, based on PEG, which replaces the LL parser. In the next Python versions, the old parser will be deleted.

This tutorial describes how to install Python 3.9 on CentOS 8 and RHEL 8 systems. In this tutorial, we will install Python from the source code.

Prerequisites

This Python installation required the GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.

sudo dnf install wget yum-utils make gcc openssl-devel bzip2-devel libffi-devel zlib-devel 

Step 1 – Download Python 3.9

Visit the official download site https://www.python.org/ftp/python to download the latest or required version of the Python.

Command line users can download Python 3.9 via command line:

wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz 

Then, extract the archive file on your system

tar xzf Python-3.9.6.tgz 

This will create a directory named Python-3.9.6 in the current directory containing all source files for Python 3.9.

Step 2 – Install Python on CentOS 8

Change directory to Python-3.9.6. Then prepare the source code with the required values before compiling it.

cd Python-3.9.6 
sudo ./configure --with-system-ffi --with-computed-gotos --enable-loadable-sqlite-extensions 

Next, compile the source code with make. Here nproc will provide the number of CPU cores available on system. So that make can perform well.

sudo make -j ${nproc} 
sudo make altinstall 
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

Now, we don’t need the downloaded archive file, so delete it to free space.

sudo rm Python-3.9.6.tgz 

Step 3 – Test Python Version

At this step, you have successfully installed Python 3.9 on CentOS/RHEL system. Now, check the installed versions of Python and PIP.

Check Python Version:

python3.9 -V  

Python 3.9.6

Check PIP Version:

pip3.9 -V  

pip 20.2.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)

Step 4 – Create Virtual Environment

It is a good idea to create a separate virtual environment for each Python application. Which provides an isolated environment where the Python project has its own modules and set of dependencies.

To create Python virtual environment, run:

sudo /usr/local/bin/python3.9 -m venv /home/rahul/python-app/venv 

All the files will be generated under /home/rahul/python-app/venv directory. You can active the environment by running command:

source /home/rahul/python-app/venv/bin/activate 

Do your stuff with isolated environment here. Once you finish with your work, deactivate the environment by typing:

deactivate 

This will return you back to the main system prompt.

Conclusion

This tutorial described you to install Python 3.9 on CentOS 8 and RHEL 8 systems using source code.

The post How to Install Python 3.9 on CentOS/RHEL 8 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-python-3-9-on-centos-8/feed/ 3
How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 34/33 https://tecadmin.net/install-python-3-9-on-centos/ https://tecadmin.net/install-python-3-9-on-centos/#comments Mon, 02 Nov 2020 15:23:10 +0000 https://tecadmin.net/?p=23349 Recently, the Python development team released the latest stable version of Python 3.9. You can download it from its official pages. The new version comes with multiple new features and security updates. This tutorial will help you to install Python 3.9 on CentOS/RHEL 7 & Fedora systems. We will compile Python from the source code. [...]

The post How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 34/33 appeared first on TecAdmin.

]]>
Recently, the Python development team released the latest stable version of Python 3.9. You can download it from its official pages. The new version comes with multiple new features and security updates.

This tutorial will help you to install Python 3.9 on CentOS/RHEL 7 & Fedora systems. We will compile Python from the source code.

Prerequisites

This Python installation required the GCC compiler on your system. Login to your server using ssh or shell access. Now, use the following command to install prerequisites for Python before installing it.

sudo yum install gcc openssl-devel bzip2-devel libffi-devel zlib-devel 

Step 1 – Download Python 3.9

Download Python using following command from python official site. You can also download the latest version in place of the specified below.

wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz 

Then, extract the archive file on your system:

tar xzf Python-3.9.6.tgz 

This will create a directory named Python-3.9.6 in the current directory.

Step 2 – Install Python 3.9 on CentOS

Change directory to Python-3.9.4 and use the following commands to compile Python source code on your system using altinstall.

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 downloaded source archive file from your system

sudo rm Python-3.9.6.tgz 

Step 3 – Test Python Version

Check the latest version installed of python using the below command

python3.9 -V  

Python 3.9.6

Conclusion

In this tutorial, you have learned to install Python 3.9 on CentOS 7 and Fedora systems using source code.

The post How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 34/33 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-python-3-9-on-centos/feed/ 3
How to Install Python 3.9 on Amazon Linux 2 https://tecadmin.net/install-python-3-9-on-amazon-linux/ https://tecadmin.net/install-python-3-9-on-amazon-linux/#comments Sat, 31 Oct 2020 09:43:12 +0000 https://tecadmin.net/?p=23449 Python is a powerful programming language. It is very friendly and easy to learn. During the latest update of this article Python 3.9.6 (of Python 3.9 series) latest stable version is available to download and install. This tutorial will help you to install Python 3.9 on Amazon Linux systems. Prerequisites Installing Python from the source [...]

The post How to Install Python 3.9 on Amazon Linux 2 appeared first on TecAdmin.

]]>
Python is a powerful programming language. It is very friendly and easy to learn. During the latest update of this article Python 3.9.6 (of Python 3.9 series) latest stable version is available to download and install.

This tutorial will help you to install Python 3.9 on Amazon Linux systems.

Prerequisites

Installing Python from the source code requires a GCC compiler. So must have installed the required development libraries first.

Open a terminal on your system install prerequisites for Python:

sudo yum install gcc openssl-devel bzip2-devel libffi-devel 

Step 1 – 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 2 – 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 3 – 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 

Python 3.9.4

Step 4 – 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 

Conclusion

In this tutorial, you have learned to install Python 3.9 on Amazon Linux using source code.

The post How to Install Python 3.9 on Amazon Linux 2 appeared first on TecAdmin.

]]>
https://tecadmin.net/install-python-3-9-on-amazon-linux/feed/ 4
How To Install Python 3.9 on Ubuntu 20.04 https://tecadmin.net/how-to-install-python-3-9-on-ubuntu-20-04/ https://tecadmin.net/how-to-install-python-3-9-on-ubuntu-20-04/#comments Sun, 25 Oct 2020 10:16:38 +0000 https://tecadmin.net/?p=23344 Python is an object-oriented, high-level programming language. It is open-source with a large community. Python is used as a key language among the top tech companies like Google. The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules, and many other features. You [...]

The post How To Install Python 3.9 on Ubuntu 20.04 appeared first on TecAdmin.

]]>
Python is an object-oriented, high-level programming language. It is open-source with a large community. Python is used as a key language among the top tech companies like Google.

The Python 3.9 stable version has been released with several improvements and security updates. It included multiple new modules, improved existing modules, and many other features.

You can choose deadsnakes PPA for Python installation on Ubuntu 20.04 system.

Use this tutorial to install Python 3.9 On Ubuntu 20.04 LTS Linux system via Apt-Get. You can also choose the second method to install Python using source code.

Prerequisites

Login to your Ubuntu system and open a terminal, then install some required packages.

sudo apt update 
sudo apt install wget software-properties-common 

Installing Python 3.9 Using Apt

Use the Ubuntu package manager Apt to install Python 3.9 on Ubuntu Linux system. Follow the below steps:

  1. Open a terminal by pressing CTRL+ALT+T and then configure deadsnakes PPA to your system.
    sudo add-apt-repository ppa:deadsnakes/ppa 
    
  2. Once you added the PPA on your Ubuntu system, update the apt cache and install Python 3.9 on Ubuntu.
    sudo apt update 
    sudo apt install python3.9 
    
  3. Wait for the installation to complete. Check the Python version by executing:
    python3.9 -V 
    
    Python 3.9.6
    

That’s it, You have successfully installed Python 3.9 on your Ubuntu 20.04 LTS system.

Installing Python 3.9 Using Source Code

You also have one more option to install Python 3.9 using source code. We don’t recommend installing Python 3.9 packages from source code. But in some cases, you may need to install Python from the source code.

So follow the below instructions to install Python 3.9 using source code on Ubuntu 20.04 Linux system.

  1. First of all, install essential packages for compiling source code. Open a terminal and execute following commands:
    sudo apt install build-essential checkinstall 
    sudo apt install libreadline-gplv2-dev libncursesw5-dev libssl-dev \
        libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev 
    
  2. Now, download the Python 3.9 source code from the official download site. Switch to a relevant directory and use wget to download the source file.
    cd /opt 
    sudo wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz 
    
  3. Next, extract the downloaded archive file and prepare the source for the installation.
    tar xzf Python-3.9.6.tgz 
    cd Python-3.9.6 
    sudo ./configure --enable-optimizations 
    
  4. Python source is ready to install. Execute make altinstall command to install Python 3.9 on your system.
    sudo make altinstall 
    

    make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

  5. The Python 3.9 has been installed on Ubuntu 18.04 system. Verify the installed version:
    python3.9 -V 
    
    Python 3.9.6
    
  6. Remove the downloaded archive to free space
    sudo rm -f /opt/Python-3.9.6.tgz 
    

Conclusion

In this tutorial, you have learned to install Python 3.9 on Ubuntu 20.04 using Apt and source code. You can try Python examples via command line.

The post How To Install Python 3.9 on Ubuntu 20.04 appeared first on TecAdmin.

]]>
https://tecadmin.net/how-to-install-python-3-9-on-ubuntu-20-04/feed/ 6