I am a Ruby programmer trying to learn Python. I am pretty familiar with pyenv since it is like a copy and paste from RBEnv. Pyenv helps in allowing to have more than one version of Python in a system and also to isolate the Python instance without touching sensitive parts of system.
I suppose every Python installation comes with a pip package. What I still don't understand is, there are many good Python libraries out there that suggest to use this virtualenv and Anaconda. I can even find a virtualenv plugin for pyenv.
Now I am getting confused with the purpose of these two, pyenv and virtualenv. Worse, inside pyenv, there is a virtualenv plugin.
It's worth mentioning pip
here as well, as conda
and pip
have similarities and differences that are relevant to this topic.
pip: the Python Package Manager.
pip
as the Python equivalent of the Ruby gem
commandpip
is not included with Python by default.brew install python
sudo easy_install pip
gemfile
pip freeze > requirements.txt
pyenv: Python Version Manager
pyenv
lets you manage this easily.virtualenv: Python Environment Manager.
virtualenv
, simply invoke virtualenv ENV
, where ENV
is is a directory to place the new virtual environment.virtualenv
, you need to source ENV/bin/activate
. To stop using, simply call deactivate
.virtualenv
, you might install all of a workspace's package requirements by running pip install -r
against the project's requirements.txt
file.Anaconda: Package Manager + Python Version Manager + Environment Manager + Additional Scientific Libraries.
conda install <packagename>
pip
+ virtualenv
, although I don't have experience using it personally.See also: