• Home
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • Ubuntu
  • Maven
  • Archived
  • About
Python | Install Python (3.11.4)
  1. References
  2. Python Installation
  3. Package Management
  4. Creating a virtual environment
  5. Activating a virtual environment
  6. Deactivating a virtual environment
  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/

    You can check your installation:


    Run a simple script from the command line:

    Create and run a simple script:

    Accessing Python Shell:
  3. 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:
  4. 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.

    Create project directory:

    Create virtual environment:

    Directory structure:
    Project structure best practices:
  5. 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:
  6. 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:
  7. The Zen of Python, by Tim Peters
    Python's guiding principles:
© 2025  mtitek