Of course. Here's a comprehensive guide to using Python on Ubuntu 17.10, covering its default state, recommended upgrades, and best practices for development.

Quick Summary
Ubuntu 17.10 is quite old and reached its End of Life (EOL) in July 2025. The single most important recommendation is to upgrade to a modern, supported version of Ubuntu.
However, if you must use 17.10, here's what you need to know:
- Default Python: Python 3.6
- Default Python 2: Python 2.7.14
- Recommendation: Use the system's
python3command for scripts and projects. Avoid usingpythonas it points to Python 2 by default. - Best Practice: Use a virtual environment (
venv) for every project to manage dependencies.
Checking Your Python Installation on Ubuntu 17.10
First, let's see what Python versions are installed on your system. Open a terminal (Ctrl+Alt+T) and run the following commands:
Check for Python 3
This is the recommended version for all new development.

python3 --version
Expected Output:
Python 3.6.6
Check for Python 2
Python 2 is legacy and should only be used for maintaining old projects.
python2 --version
Expected Output:
Python 2.7.14
The python Command
Notice that running python --version on Ubuntu 17.10 points to Python 2. This was the historical default.

python --version
Expected Output:
Python 2.7.14
This is why you should always use python3 for new projects.
Installing Python 3 (If Needed)
Ubuntu 17.10 comes with Python 3.6 pre-installed, but if for some reason it's missing, you can install it easily.
# Update your package list sudo apt update # Install Python 3 and its development tools sudo apt install python3 python3-pip python3-venv
python3: The Python 3 interpreter.python3-pip: The package installer for Python 3 (likeaptbut for Python libraries).python3-venv: The module for creating virtual environments.
The Best Practice: Using Virtual Environments
Virtual environments are essential for Python development. They create an isolated space for each project's dependencies, preventing version conflicts.
Here’s how to set one up:
-
Navigate to your project directory:
cd my_awesome_project
-
Create the virtual environment: We'll call it
venv.python3 -m venv venv
This command uses the
venvmodule to create a new directory namedvenvcontaining a self-contained Python installation. -
Activate the virtual environment:
source venv/bin/activate
Your terminal prompt will change to show
(venv), indicating the environment is active. Now, when you runpythonorpip, it will use the ones inside yourvenvdirectory. -
Install packages: With the environment active, install packages using
pip3(or justpip, which now points to the pip for Python 3).(venv) pip install requests numpy
-
Deactivate the environment when you're done:
(venv) deactivate
Your prompt will return to normal.
Installing Packages with pip
Once your virtual environment is active, installing Python packages is straightforward.
# Activate your virtual environment first source venv/bin/activate # Install a package pip install <package_name> # Example: Install a web framework pip install flask # Upgrade a package pip install --upgrade <package_name> # Uninstall a package pip uninstall <package_name> # List installed packages pip list
Running Python Scripts
-
Create a simple script,
hello.py:nano hello.py
Add the following content:
print("Hello from Python 3!")Save and exit (
Ctrl+X, thenY, thenEnter). -
Make it executable:
chmod +x hello.py
-
Run it using
python3:python3 hello.py
Output:
Hello from Python 3!
Critical Warning: Ubuntu 17.10 is End-of-Life (EOL)
This is the most important point in this guide. Ubuntu 17.10 no longer receives security updates or bug fixes.
Running an EOL operating system on a machine connected to the internet is a significant security risk.
Strongly Recommended Action: Upgrade Your System
You should upgrade to a Long-Term Support (LTS) version like Ubuntu 20.04 LTS, 22.04 LTS, or the latest 24.04 LTS. LTS versions receive security updates for 5 years.
To upgrade, follow the official Ubuntu documentation: https://ubuntu.com/tutorials/how-to-ubuntu-2004
Summary Table for Ubuntu 17.10
| Task | Command | Notes |
|---|---|---|
| Check Python 3 | python3 --version |
Should be Python 3.6.6. |
| Check Python 2 | python2 --version |
Legacy version. |
| Install Packages | pip install <package> |
Only do this inside a virtual environment. |
| Create Venv | python3 -m venv venv |
Creates an isolated environment for your project. |
| Activate Venv | source venv/bin/activate |
Your prompt will change to (venv). |
| Deactivate Venv | deactivate |
Exits the virtual environment. |
| Run Script | python3 my_script.py |
Always use python3 to be explicit. |
| System Status | End-of-Life (EOL) | No security updates. Upgrade to a modern LTS version immediately. |
