I am a ruby programmer trying to learn python. I am pretty family with pyenv since it is like a copy and paste from rbenv. Pyenv helps allow to have more than one version of python in a system and also to isolate the python without touching sensitive part of system.
I suppose every python installation come with pip package. What I still don't understand is, there are many good python libs out there that suggest to use this virtualenv and anaconda. I can even find 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.
my questions are:
- what is the difference between pyenv and virtualenv?
- Is there any difference in using pip command inside both pyenv and virtualenv?
- what does this pyenv virutalenv do?
your explanation with example will be highly appreciated.
Edit: It's worth mentioning
pip
here as well, asconda
andpip
have similarities and differences that are relevant to this topic.pip: the Python Package Manager.
pip
as the python equivalent of the rubygem
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 invokevirtualenv ENV
, whereENV
is is a directory to place the new virtual environment.virtualenv
, you need tosource ENV/bin/activate
. To stop using, simply calldeactivate
.virtualenv
, you might install all of a workspace's package requirements by runningpip install -r
against the project'srequirements.txt
file.Anaconda: Package Manager + Environment Manager + Additional Scientific Libraries.
conda install <packagename>
miniconda
version, which seems like it could be a more simple option than usingpip
+virtualenv
, although I don't have experience using it personally.conda
allows you to install packages, these packages are separate than PyPI packages, so you may still need to use pip additionally depending on the types of packages you need to install.See also: