• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Python | Install Python (3.11.4)
  1. Installing Python
  2. Creating a virtual environment
  3. Activating a virtual environment
  4. Deactivating a virtual environment
  5. The Zen of Python, by Tim Peters

  1. Installing Python
    You can use your os package manger to install Python and any other optional packages.

    Ubuntu:

    Red Hat:

    You can also install Python from source: https://devguide.python.org/getting-started/setup-building/

    You can check your installation:

    Installing a new Python package (with the "--user" flag, the package will be installed for the specified user only):
    Upgrading an existing package:
    You can use the same command to upgrade pip:
    Accessing Python Shell:
    Execute a Python program in file:
  2. Creating a virtual environment
    venv module: https://docs.python.org/3/library/venv.html

    A virtual environment is an environment where all new installed packages are isolated and independent from the Python base installation. Within the virtual environment you can use packages that have already been installed in the Python base installation.

    To create a virtual environment, you need run the "venv" virtual environment module from a specific location of your project. You need to provide a location and name for the virtual environment.

  3. Activating a virtual environment
    To activate a virtual environment, you need to execute the command "activate" in "/home/mtitek/python/py_venv/bin/":
    When the virtual environment is active, you will see the name of the environment in parentheses ("(py_venv)").
  4. Deactivating a virtual environment
    To deactivate and stop using a virtual environment, you need to execute the command "deactivate":
    You can also deactivate the virtual environment by closing the terminal it's running in.
    The packages installed in the virtual environment will not be available when the environment is deactivated.
  5. The Zen of Python, by Tim Peters
© 2025  mtitek