• Home
  • LLMs
  • Python
  • Docker
  • Kubernetes
  • Java
  • All
  • About
Python | Installing Python
  1. References
  2. Python Installation (3.12.3)
  3. Creating a virtual environment
  4. Activating a virtual environment
  5. Deactivating a virtual environment
  6. Package Management
  7. The Zen of Python, by Tim Peters

  1. References
    The official home of the Python Programming Language:
    https://python.org

    Python Developer’s Guide:
    https://devguide.python.org

    Visual Studio Code: source-code editor, by Microsoft:
    https://code.visualstudio.com

    PyCharm: the Python IDE, by JetBrains:
    https://www.jetbrains.com/pycharm

    Jupyter:
    https://jupyter.org
  2. Python Installation
    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/

    Check your installation:


    Run a simple script from the command line:

    Create and run a simple script:

    Accessing Python Shell:
  3. Creating a virtual environment
    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.

    See this page for more details about the venv module: https://docs.python.org/3/library/venv.html

    Create project directory:

    Create virtual environment:

    Directory structure:

    Python project structure:
  4. Activating a virtual environment
    To activate a virtual environment, you need to execute the command "activate" in ".venv/bin/":
    When the virtual environment is active, you will see the name of the environment in parentheses ("(.venv)").

    Environment verification:
  5. 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.

    To clean the virtual environment in your project directory, you can simply delete the virtual environment folder:
  6. Package Management
    Install a package:

    Use "--user" to install the package for the current user only:
    Install a specific version of a package:

    Install packages from requirements file:

    List installed packages:
    Show package information:
    Upgrade a package:
    Upgrade pip itself:
    Uninstall a package:
    Create a requirements file:
  7. The Zen of Python, by Tim Peters
    Python's guiding principles:
© 2025  mtitek