I used to be a pyenv believer, but I decided to change my mind by reading Flowchart whether pyenv is needed --Qiita. So, I would like to summarize how to build a Python environment using Virtualenv on Ubuntu 18.04 LTS.
This article is for people who fall under the following.
3.5.0
and 3.6.0
).It is a tool to separate the environment like the environment for project A, the environment for project B ... etc. There is an advantage that you can prepare an execution environment and libraries suitable for each environment without polluting the Python environment installed on the system.
Run the sudo apt install virtualenv virtualenvwrapper
command to install Virtualenv.
Execute the mkvirtualenv --python = / usr / bin / {python execution command} {environment name}
command.
Python version | Execution command |
---|---|
Python 2.x | python |
Python 3.x | python3 |
Execute the workon {environment name}
command.
({environment name})
is added to the beginning of the command line, it is successful.Execute the deactivate
command.
Execute the rmvirtualenv {environment name}
command.
Recommended Posts