Short Question
- What is the proper way to install
pip
,virtualenv
, anddistribute
?
Background
In my answer to SO question 4314376, I recommended using ez_setup
so that you could then install pip
and virtualenv
as follows:
curl -O http://peak.telecommunity.com/dist/ez_setup.py
sudo python ez_setup.py
sudo easy_install pip
sudo pip install virtualenv
I originally pulled these instructions from Jesse Noller's blog post So you want to use Python on the Mac?. I like the idea of keeping a clean global site-packages directory, so the only other packages I install there are virtualenvwrapper
and distribute
. (I recently added distribute
to my toolbox because of this Python public service announcement. To install these two packages, I used:
sudo pip install virtualenvwrapper
curl -O http://python-distribute.org/distribute_setup.py
sudo python distribute_setup.py
No more setuptools and easy_install
To really follow that Python public service announcement, on a fresh Python install, I would do the following:
curl -O http://python-distribute.org/distribute_setup.py
sudo python distribute_setup.py
sudo easy_install pip
sudo pip install virtualenv
sudo pip install virtualenvwrapper
Glyph's Rebuke
In a comment to my answer to SO question 4314376, SO user Glyph stated:
NO. NEVER EVER do
sudo python setup.py install
whatever. Write a ~/.pydistutils.cfg that puts your pip installation into ~/.local or something. Especially files namedez_setup.py
tend to suck down newer versions of things like setuptools and easy_install, which can potentially break other things on your operating system.
Back to the short question
So Glyph's response leads me to my original question:
- What is the proper way to install
pip
,virtualenv
, anddistribute
?
python distribute_setup.py
followed byeasy_install pip
andvirtualenv --distribute venv
? (see python-guide.readthedocs.org/en/latest/starting/install/…), and if so, why? – Subclinicalsudo apt-get install python-{pip,virtualenv}
??? – Subordinarypython3-pip
andpython3-virtualenv
for most distros. – Subordinarypip
,virtualenv
, and the Python PSA. – Alliterationhttp://python-distribute.org/distribute_setup.py
redirects to 404 :( – Hawkenpip
has come pre-installed with Python since 3.4 (and 2.7.9); virtualenv since 3.3; anddistribute
has been obsolete for a long time (per PyPA recommendations, usebuild
andtwine
, which you can trivially install usingpip
; or use any number of third-party options such aspoetry
; even the most bare-bones approach would usesetuptools
rather thandistribute
). – Thereabout