WebFaction
Community site: login faq
0
1

I know that setuptools and easy_install are being phased out of python3, and pip (with distribute) is preferred.

How do I install pip for python3?

asked 23 Feb '13, 19:22

ryans ♦♦
5.0k103860
accept rate: 43%

edited 23 Feb '13, 19:22


You can install distribute and pip using the following. This works equally well for python2 and python3:

PYTHON=python3.3

mkdir -p $HOME/src $HOME/lib/$PYTHON/site-packages
cd $HOME/src
wget 'https://pypi.python.org/packages/source/d/distribute/distribute-0.6.35.tar.gz'
tar -xzf distribute-0.6.35.tar.gz
cd distribute-0.6.35
PYTHONUSERBASE=$HOME PYTHONPATH=$HOME/lib/$PYTHON/site-packages $PYTHON distribute_setup.py --user

cd $HOME/src
wget 'https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz'
tar -xzf pip-1.2.1.tar.gz
cd pip-1.2.1
PYTHONPATH=$HOME/lib/$PYTHON/site-packages $PYTHON setup.py install --prefix=$HOME

When installing python packages, install them with:

PYTHONUSERBASE=$HOME pip install --user some_package

Alternatively, you can set PYTHONUSERBASE and PIP_INSTALL_OPTION (perhaps in your ~/.bashrc file):

export PYTHONUSERBASE=$HOME
export PIP_INSTALL_OPTION="--user"

Then, you can install packages simply using:

pip install some_package

Hope that helps!

permanent link

answered 23 Feb '13, 19:23

ryans ♦♦
5.0k103860
accept rate: 43%

edited 23 Feb '13, 19:38

The line PYTHONUSERBASE=$HOME PYTHONPATH=$HOME/lib/$PYTHON/site-packages $PYTHON distribute_setup.py --user doesn't work for distribte 0.7.3. I realized this is because distribute_setup.py is actually named setup.py, but when I made that change & ran the command again, it just spits out the usage information for setup.py. I'm not quite familiar enough with the commandline to know just what I can get away with changing here to make it work.

(21 Feb '14, 18:04) Zamphatta

The Python packaging story has changed since this Q&A was originally posted. Distribute has been merged back into Setuptools, and Setuptools is already installed for Python 3.3 on your server.

If you want to install pip for Python 3.3, it is as simple as:

cd ~
wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
python3.3 get-pip.py --user

Hope that helps!

(21 Feb '14, 20:02) seanf

The line PYTHONUSERBASE=$HOME PYTHONPATH=$HOME/lib/$PYTHON/site-packages $PYTHON distribute_setup.py --user doesn't work for distribte 0.7.3. I realized this is because distribute_setup.py is actually named setup.py, but when I made that change & ran the command again, it just spits out the usage information for setup.py. I'm not quite familiar enough with the commandline to know just what I can get away with changing here to make it work.

permanent link

answered 21 Feb '14, 18:03

Zamphatta
315
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×54
×23
×3

question asked: 23 Feb '13, 19:22

question was seen: 6,961 times

last updated: 21 Feb '14, 20:02

                              
WEBFACTION
REACH US
SUPPORT
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM