When I was trying to create a python environment when using TensorFlow, there was pyenv`` virtualenv
pyenv-virtualenv
and I was confused, so I summarized it.
pyenv You can specify the version to be used globally and the version to be used locally (for each directory) as shown below.
% cd python3.6.0
% pyenv local 3.6.0
% pyenv version
3.6.0 (set by /Users/hogehoge/work/python3.6.0/.python-version)
% cd ../
% pyenv version
2.7.13 (set by /Users/hogehoge/.pyenv/version)
virtualenv
virtualenv allows you to create a virtual environment
Available by source django / bin / activate
The following is, for example, when creating a virtual environment for django
% mkdir virtualenv-sandbox
% cd virtualenv-sandbox
% virtualenv django
% source django/bin/activate
(django) [hoge@moge-no-MacBook-Air] ~/work/virtualenv-sandbox
% pip list
appdirs (1.4.3)
packaging (16.8)
pip (9.0.1)
pyparsing (2.2.0)
setuptools (34.3.3)
six (1.10.0)
wheel (0.29.0)
% pip install django
Collecting django
Downloading Django-1.10.6-py2.py3-none-any.whl (6.8MB)
100% |████████████████████████████████| 6.8MB 175kB/s
Installing collected packages: django
Successfully installed django-1.10.6
% pip list
appdirs (1.4.3)
Django (1.10.6)
packaging (16.8)
pip (9.0.1)
pyparsing (2.2.0)
setuptools (34.3.3)
six (1.10.0)
wheel (0.29.0)
You can get out of the development environment by deactivating.
After deactivating, I did pip list
and confirmed that Django wasn't there.
% deactivate
% pip list
pip (9.0.1)
setuptools (28.8.0)
virtualenv (15.1.0)
pyenv-virtualenv
You can create a virtual environment with a mechanism different from the above virtualenv
Extension of pyenv
It will be available with pyenv activate
I will write it again
Looking at the installation of TensorFlow, it uses virtualenv, so I will use this. https://www.tensorflow.org/install/install_mac
http://dackdive.hateblo.jp/entry/2015/12/12/163400 http://qiita.com/bohemian916/items/4f0736dcea932a162d9e
Recommended Posts