Python

[Python] venv

llHoYall 2020. 8. 29. 20:21

venv provides python virtual environment, so it helps to separate a package dependencies per project.

we had to use virtualenv before Python 3.4, but since then it has been built-in as a basic tool.

Usage

The following usage contains a <name>. It means that the name of virtual environment and it will become a folder name as well.

Create a virtual environment

$ python3 -m venv <name>

Activate a virtual environment

- On MAC / Linux

$ source ./<name>/bin/activate

- On Windows

$ .\<name>\Scripts\activate

Deactivate a virtual environment

$ deactivate
반응형