When developing an application, there is also work in a virtual environment, so I will summarize the procedure.
In the terminal, go to the project for which you want to build a virtual environment. Go to it and run the following command:
$ python -m venv myenv(The name of the virtual environment)
$ ls
myenv
This time I created a virtual environment named myenv. When you display the contents of the target project with ls, a virtual environment with the specified name is created.
Now that we have built the virtual environment, we need to "enter" the virtual environment. To enter the virtual environment, type the following command.
$source myenv (name of virtual environment)/bin/activate
(myenv)$
There is a (myenv) in front of the $. With this, it will be displayed that you are in a virtual environment.
You may want to finish your work in a virtual environment after the work has settled down. In such a case, type the following command to "exit" from the virtual environment.
(myenv)$ deactivate
$
There is no (myenv) before the $. You are now out of the virtual environment.
Basically, there is no problem if you remember `source virtual environment name / bin / activate``` when entering and
`deactivate``` when exiting.
Recommended Posts