β

Install Python Setuptools/Distribute for Python 2.

Zhou\'s Blog 350 阅读

Since Setuptools doesn’t support Python3.* so far, for Python3.* we choose Distribute, it is a fork of the Setuptools project.

Distribute is intended to replace Setuptools as the standard method for working with Python module distributions.

Install python Setuptools with easy_install for Python 2.x

1 Download setuptools from http://pypi.python.org/pypi/setuptools/, select the appropriate OS/version you want.

sudo sh Downloads/setuptools-0.6c11-py2.7.egg

Output:

Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin

Install python Distribute with easy_install for Python 3.x

curl -O http://python-distribute.org/distribute_setup.py
sudo <python-cmd> distribute_setup.py

Output:

Adding distribute 0.6.28 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-3.2 script to /usr/local/bin

Note: Make sure <python-cmd> is a python3.* command, in my PC, Python2.* command is python, while the Python3.* command is python3, use <python-cmd> –version to check out version of <python-cmd>.

Use easy_install 2.x and 3.x

Now per installing 2.x packages, using:

easy_install-2.7  <package-name>

while using

easy_install-3.2  <package-name>

to install version 3.x packages.

---EOF---

作者:Zhou\'s Blog
原文地址:Install Python Setuptools/Distribute for Python 2., 感谢原作者分享。