When you want to use multiple versions of the same Python library (virtual environment using venv)

Why do you need a virtual environment?

In Python, you can't install multiple versions of the same library in one environment, so you're drinking one version. For example, suppose you have program A that uses library 1 and program B that uses library 2. At this time, program A or B will not work.

How to use a virtual environment in Python

You can use a standard module called venc to create a virtual environment.

How to use the virtual environment

For macOS

$ python3 -m venv environment name

Will create a directory with the environment name in the current directory. The name of the directory can be set freely

Enable virtual environment

Run the activate script

$.Environment name/bin/activate

Disable virtual environment

(Environment name)$ deactivate

Delete the entire directory when the virtual environment itself is no longer needed

Recommended Posts

When you want to use multiple versions of the same Python library (virtual environment using venv)
How to handle multiple versions of CUDA in the same environment
Python Note: When you want to know the attributes of an object
Use multiple versions of python environment with pyenv
How to build an environment when you want to use python2.7 after installing Anaconda3
I want to use Python in the environment of pyenv + pipenv on Windows 10
How to build an environment for using multiple versions of Python on Mac
Solution when you want to use cv_bridge with python3 (virtualenv)
If you want your colleagues to use the same language
I know? Data analysis using Python or things you want to use when you want with numpy
[Python] When you want to import and use your own package in the upper directory
[Python] When you want to use all variables in another file
When you want to save the result of the callback function somewhere
When you want to replace multiple characters in a string without using regular expressions in python3 series
About the virtual environment of python version 3.7
Install multiple versions of Polyphony using venv
Installation method using the pip command of the Python package (library) Mac environment
When you want to change the HTTP headers of Flask's test client
[Python] If you want to draw a scatter plot of multiple clusters
How to use the C library in Python
When you want to update the chrome driver.
Use jupyter-lab installed in python virtual environment (venv)
When using PyQtGraph with Python Pyside, pay attention to the order of import
Use PIL in Python to extract only the data you want from Exif
What you want to memorize with the basic "string manipulation" grammar of python
When you can't uninstall the python library. Can't uninstall'hogehoge'. No files were found to uninstall.
If you want to enter the virtual environment with jupyter, nb_conda_kernels is recommended
Python virtual environment in 2021 ~ There is no reason not to use venv now ~
[Python3] Code that can be used when you want to change the extension of an image at once
I wanted to use the Python library from MATLAB
A convenient function memo to use when you want to enter the debugger if an error occurs when running a Python script.
[Python] How to use the graph creation library Altair
Build a Python virtual environment using venv (Django + MySQL ①)
[Introduction to Python] Basic usage of the library matplotlib
What to do if you don't want to use Japanese column names when using ortoolpy.logistics_network
The programming language you want to be able to use
I want to use the R dataset in python
I want to be notified of the connection environment when the Raspberry Pi connects to the network
What to do if you can't create a virtual environment using venv even though you're following the Django official website
If you want to use field names with hyphens when updating firestore data in python
[Django] A memorandum when you want to communicate asynchronously [Python3]
Using multiple versions of Python on Mac OS X (2) Usage
I want to use only the normalization process of SudachiPy
Use aggdraw when you want to draw beautifully with pillow
[Python] I want to use the -h option with argparse
How to develop in a virtual environment of Python [Memo]
I want to use a virtual environment with jupyter notebook!
(Python3) No. oO (Are you using the standard library?): 5 shaders
I want to know the features of Python and pip
When you want to use python2.x on modern Gentoo Linux
pyenv, virtualenv Use docker to manage the environment without using
When you want to hit a UNIX command on Python
List of libraries to install when installing Python using Pyenv
Overview of Python virtual environment and how to create it
Install multiple versions of Python
venv: Python virtual environment management
python standard virtual environment venv
How to write when you want to put a number after the group number to be replaced with a regular expression in re.sub of Python
pyenv, virtualenv Use docker to manage the environment without using
Build a simple Python virtual environment without pyenv
[Django] Carefully explain the escape route if you really want to use the table of another application
[Subprocess] When you want to execute another Python program in Python code