creating a python virtual environment

When starting a new python project, it is usually sound practice to use a dedicated virtual environment.
By doing so your project is isolated from other applications using python and all dependencies can be properly tracked.

  1. ensure python is installed
  2. ensure pip is installed (note: starting python3.4, pip is installed by default)
  3. ensure virtualenv is installed (note: starting python3.3, venv is installed by default)

In a nutshell, if you have python >= python3.4, nothing to install!! Easy 🙂

Run below commands:

  • cd <path/to/my/project>
  • python3 -m venv ./virtualenv

Done.

Run

source ./virtualenv/bin/activate

to activate your virtual environment

sources

Post a Comment

Your email is never published nor shared. You're allow to say what you want...