It is a basic command memo of virtualenv, a virtual environment creation tool in python.
Like any other python package, you can install it with the pip command.
$ pip install virtualenv
Cd to the project you want to create a virtual environment and hit the following command to create the virtual environment. The virtual environment name can be any name. From now on, we will use a virtual environment named my_env.
#Virtual environment my for a specific project_Create env.
$ cd (The project you want to create a virtual environment)
$ virtualenv my_env
The virtual environment is not valid just by creating it You need to enable it as follows:
#Enable the virtual environment myenv
$ source myenv/bin/activate
#If the following is displayed on the console, it is successful.!
(myenv) $
#The virtual environment is clean when it is just created.
#If you try pip freeze, you will see that only the minimum number of packages are installed.
(myenv) $ pip freeze
appdirs==1.4.3
packaging==16.8
pyparsing==2.2.0
six==1.10.0
Do the following for each.
#Disable virtual environment
(myenv) $ deactivate
#Delete virtual environment
# (You can delete the entire folder created directly under the project.)
$ rm -rf myenv/
Recommended Posts