SaoudAlawi / auto-regression

AutoML Application
1 stars 0 forks source link

Create virtual env #3

Open SaoudAlawi opened 2 years ago

SaoudAlawi commented 2 years ago

The key benefit of doing so is to ensure the separation and consultancy of packages across all deployments. There are 2 main ways to create a python virtual env:

1. Anaconda

Must install Anaconda on the machine. (Pian)

venv package

The venv module provides support for creating lightweight “virtual environments” with their own site directories, optionally isolated from system site directories. Each virtual environment has its own Python binary (which matches the version of the binary that was used to create this environment) and can have its own independent set of installed Python packages in its site directories.

Creating a new python virtual environment

  1. Run venv command
    python3 -m venv /path/to/new/virtual/environment
  2. Managing Packages with pip. pip has a number of subcommands: “install”, “uninstall”, “freeze”, etc.
    pip install <package name>==<package version>

    Save the created env

    pip freeze will produce a similar list of the installed packages, but the output uses the format that pip install expects. A common convention is to put this list in a requirements.txt file:

    pip freeze > requirements.txt

    The requirements.txt can then be committed to version control and shipped as part of an application. Users can then install all the necessary packages with install -r:

    python -m pip install -r requirements.txt