Setuptools and Easy_install Introduction and Installation Methods

Source: Internet
Author: User
Tags python mysql

A setuptools and a easy_install

Setuptools:setuptools is an enhanced tool for Python's distutils tools developed by the peak (Python Enterprise application Kit) to make it easier for programmers to create and publish Python's egg package, especially those that have dependencies on other packages. Packages created and published by Setuptools appear to be no different from the packages that are published based on Distutils. The end user does not need to install setuptools in advance or even need to know the existence of setuptools, and the programmer does not need to attach the complete setuptools, only need to contain a size of about 8K ez_ The script, as a startup module, allows these packages to be automatically downloaded and installed setuptools when an appropriate version of Setuptools is not installed by the end user.

Easy_install: People who often use Python may use the Easy_install command when they need to install a third-party python package. Easy_install is a command from the Setuptools package developed by the Peak (Python Enterprise application Kit), which is used to automate the To install the egg pack, which is equivalent to the Yum command in Perl, CPAN or PPM, redhat, but the system does not have the Easy_install command preinstalled.

Second, install Setuptools on Windows (must be pre-installed Python environment, PATH=D:\PYTHON26)

Method 1: Download the exe installation file, setuptools-0.6c11.win32-py2.6

If you have previously installed an older version of Setuptools, you will need to remove all Setuptools*.egg and setuptools.pth files from the Site-packages directory (and any other Sys.path directories) in your system prior to installation.

If you previously installed setuptools with the. exe installer, uninstall the old version in Add/Remove programs before installing.

After the installation is complete, the Easy_install.exe program appears in the Python scripts subdirectory. Ensure that this directory (for example, d:\Python26\Scripts) is added to the PATH environment variable.

Method Two: Manual Installation

Uninstalling the old version is the same as method one.

Download the script and run it on the command line: Python

Third, install Setuptools on Linux (must be pre-installed Python environment)

The Debian/ubuntu system can be installed directly using Apt-get:

$ sudo apt-get install python-setuptools Python-setuptools-dev

The Redhat/centos system can be installed directly using Yum:

$ yum Install Python-setuptools Python-setuptools-dev

There are two ways to install them manually:

Method One: Install through the bootloader This bootloader will download the latest version of Setuptools to install, and can also update the local setuptools.

$ wget

$ sudo python

Update Setuptools:

sudo python setuptools

Method Two: Download the Setuptools Egg Pack and install it via SH.

$ wget Https://

$ sudo sh setuptools-0.6c11-py2.6.egg

Method Three: Source code compilation and installation


$ tar zxvf setuptools-5.7.tar.gz

$ CD setuptools-5.7

$ python Install

$ wget

$ tar zxvf setuptools-0.6c11.tar.gz


$ python Install

Use of four Easy_install

1) Use Easy_install to install the egg pack

For example, to install the Python MySQL support, you can execute the following command, the system will automatically find the relevant package in the PYPI Web site list: Easy_install Mysql-python.

With Easy_install installation software, the relevant installation information will be saved to the Easy-install.pth file, the path is similar to the following form: C:\Python25\Lib\site-packages\easy-install.pth.

If you want to delete a package installed through Easy_install, say: Mysql-python, you can execute the command: Easy_install-m Mysql-python.

2) Download the egg installation package to a local installation

Go to the directory of the installation package, execute the python install

3) If Easy_install install a module is wrong, you can download it yourself to, and then use the Python install.

How to install the Easy_install command:

1. Download Setuptools:

wget Https://

2, Installation Setuptlls

3. Test Easy_install command


Mounting module

Easy_install package-name (e.g. Easy_install Pylab)

Module uninstallation

Easy_install-m package-name (e.g. easy_install-m Pylab)

EASY_INSTALL-M package name, you can uninstall the package, but also manually delete the legacy files after uninstallation.

Five, Python package management tools--Summary

1, source package Ipython:




$ python Install

2. Binary package: Yum install Ipython

3, Easy_install:


$ sh Setuptools-0.6c9-py2.4.egg


$ yum-y Install Python-setuptools Python-setuptools-devel

Problem one: I can't find python.h

$ yum-y Install Python-devel


Rpm-e Python-setuptools

# #Install Ipython:

$ Easy_install Ipython

4 , Pip (recommended)

1.1 Install Setuptools First


$ tar zxvf setuptools-5.7.tar.gz

$ CD setuptools-5.7

$ python Install

1.2 Re-install PIP

$ easy_install pip


# # Install Pip

$ wget

$ sudo python


$ wget

$ tar zxvf pip-1.5.6.tar.gz

$ CD pip-1.5.6

$ python Install

# # PIP Version information

$ pip--version

Pip 1.5.6 from/usr/local/lib/python2.7/dist-packages (Python 2.7)

1.3 Installing Ipython

$ pip Install Ipython


IPython 1.0: Requires python≥2.6.5 or≥3.2.1. Python 3.0, 3.1, or 2.5 are not supported.

IPython2.0: Requires python≥2.7.2 or ≥3.3.0 and does not support Python 3.0, 3.1, 3.2, 2.5, or 2.6.

If you install Ipython because of an error in the version issue, you can use:

Pip Install ipython==1.2.1


$ easy_install pip

Ipython Installation

IPython is a python interactive shell that works much better than the default Python shell, supports variable auto-completion, auto-indent, supports bash shell commands, and has many useful functions and functions built into it.

Official website:

# Centos

sudo yum install Python-ipython-notebook

# Debian/ubuntu

sudo apt-get install Ipython-notebook

$ wget

$ tar zxvf ipython-2.2.0.tar.gz

$ CD ipython-2.2.0

$ sudo python install

Module Installation Location:/usr/lib/python2.6/site-packages/ipython-1.2.1-py2.6.egg-info

Start with Ipython.

IPython Magic Function

Magic function of Ipython

Ipython provides a powerful, built-in magic function, defined as: Ipython any first-letter% line as a special call to the Magic function, you can control the Ipython and add many system functions to it.

In [2]:%lsmagic: List all the magic functions of Ipython

In [6]:%magic: View Ipython Magic Help information

in [+]:%quickref Page view Help information

Flist can be filtered by grep and fields



This article is from the "Technology Life" blog, please be sure to keep this source

Setuptools and Easy_install Introduction and Installation Methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.