venv (Python)

What is venv

Venv is used when separating the Python execution environment, such as when you want to change the Python execution environment for each project or when you do not want to pollute the local environment. You can easily create a virtual environment for each project by collecting the dependencies of Python binaries and libraries under an arbitrary directory and overwriting PATH.

##Installation(Ubuntu20.04)
$ sudo apt install python3-venv
$ python3.7 -m venv PJ001
$ ls PJ001/
bin  include  lib  lib64  pyvenv.cfg  share

##Create virtual environment
$ source PJ001/bin/activate
(PJ001) $ 

##When exiting
(PJ001) $ deactivate

The Python executable file of the virtual environment and the executable file of other packages are placed in bin. Library files used in the virtual environment are placed in lib and ʻinclude (new packages added after ʻactivate are installed underlib / pythonX.Y / site-packages /). Execute deactivate to exit.

Difference between virtualenv and venv

A similar tool that has been around for a long time is virtualenv. It is recommended to use venv for Python 3.4 or later.

Recommended Posts

venv (Python)
Python3, venv and Ansible
venv: Python virtual environment management
python with pyenv and venv
python standard virtual environment venv
python3.8 venv environment jupyter notebook
kafka python
Python basics ⑤
python + lottery 6
Python Summary
Python comprehension
Python technique
Studying python
Python memorandum
Python FlowFishMaster
Python service
python tips
python function ①
Python basics
Python memo
ufo-> python (3)
Python comprehension
install python
Python Singleton
Python basics ④
Python Memorandum 2
python memo
Python Jinja2
Python increment
atCoder 173 Python
[Python] function
Python installation
python tips
Installing Python 3.4.3.
Try python
Python memo
Python iterative
Python algorithm
Python2 + word2vec
[Python] Variables
Python sys.intern ()
Python tutorial
Python decimals
python underscore
Python summary
Start python
Note: Python
Python basics ③
python log
Python basics
[Scraping] Python scraping
Python update (2.6-> 2.7)
python memo
Python memorandum
Python # sort
ufo-> python
Python nslookup
python learning
Hannari Python 2020
[Rpmbuild] Python 3.7.3.
Prorate Python (1)