I will post a memo of the procedure of the virtual environment of python on mac.
■ Homebrew A tool to install what you need.
■ pyenv A tool for easily switching between Python versions.
■ venv Python standard virtual environment tool
Create a folder. The name can be anything, so this time I will use "python" for easy understanding.
cd /Users/※username/python
Move to the folder created above and enter the following. Anything is ok because the place of "pyenv" is arbitrary. Since it is a virtual environment, set it to "pyenv". By the way, this is a virtual environment
python -m venv pyenv
If you enter the above, a "pyenv" folder will be created, so enter the folder.
cd /Users/※username/python/pyenv
In the "pyenv" folder
. bin/activate
When you enter
(pyenv)Somehow:pyenv * User name$
This is the so-called virtual environment. Even if you install various things here, there is no effect on the main unit. By the way
. bin/activate
If it doesn't work even if you enter
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
After trying this
. bin/activate
Please try.
When disabling the virtual environment
deactivate
This will come out.
Recommended Posts