Python is a popular programming language known for its simplicity and versatility. With the release of Python 3.13, users can enjoy new features and improvements to the language. In this article, we will guide you through the installation of Python 3.13 on a Linux operating system, along with hands-on examples to help you get started with coding.
First, you will need to have a Linux system up and running. Python 3.13 is not officially released yet at the time of writing this article, so we will use Python 3.12 as an example. However, the installation process for Python 3.13 should be similar.
To begin, open a terminal window on your Linux system and follow these steps:
-
Update your package list: Before installing Python 3.13, it is recommended to update your package list to ensure you are installing the latest version available. Run the following command:
sudo apt update
-
Install the dependencies: Next, install the dependencies required for building Python from source. Run the following command:
sudo apt install -y build-essential libssl-dev zlib1g-dev libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev libdb5.3++-dev libbz2-dev libexpat1-dev liblzma-dev libffi-dev
-
Download Python source code: Visit the official Python website and download the source code for Python 3.13 (or the latest version available). Alternatively, you can use the following command to download Python 3.12:
wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz
-
Extract the source code: Once the download is complete, extract the source code using the following command:
tar -xf Python-3.12.0.tgz
-
Configure and build Python: Navigate to the extracted directory and run the following commands to configure and build Python:
cd Python-3.12.0 ./configure make -j $(nproc) sudo make install
- Verify the installation: After the installation process is complete, verify that Python 3.13 is installed correctly by running the following command:
python3.13 --version
You should see the version number of Python 3.13 displayed on the screen if the installation was successful.
Now that you have Python 3.13 installed on your Linux system, let’s try some hands-on examples to get you started with coding. Create a new Python script using a text editor and paste the following code:
print("Welcome to Python 3.13!")
name = input("What is your name? ")
print("Hello, " + name + "!")
Save the file as hello.py
and run it using the following command:
python3.13 hello.py
You should see the output "Welcome to Python 3.13!" followed by a prompt to enter your name. After entering your name, the script will greet you with a personalized message.
Congratulations! You have successfully installed Python 3.13 on your Linux system and tried your first Python script. Explore more features and functionalities of Python 3.13 to unleash your creativity and build amazing applications. Happy coding!