I investigated the virtual environment because I was using it without knowing it well. In this article, I will briefly explain what a virtual environment is and how to create it.
Simply put, it's a ** space for running programs **. Install and use various libraries in this space.
To solve problems such as "interference between libraries" and "incompatibility between libraries and frameworks".
--If you use frameworks and libraries without a virtual environment, libraries will be added to one place more and more. --As a result, complex libraries may interfere with each other and not work well.
――It is possible to select the version of python as you like and the framework library to use, such as "Virtual environment for machine learning of python3.x series" and "Virtual environment for analysis of python2.x series". Become. --As a result, problems such as interference between libraries can be avoided.
Such. This time, I will explain how to create a virtual environment using ** venv ** below.
venv is ready to use with Python 3.4 and above. The command to check the python version is as follows.
$ python -V
It can be created with the following command.
$ python -m venv ****
When you create a virtual environment, the files in the virtual environment are set in the working directory. You can check it with the following command.
$ ls -la
Next, enable the created virtual environment with the following command.
$ source ****/bin/activate
Recommended Posts