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 setup.py 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 http://pypi.python.org/simple/ 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 ez_setup.py script and run it on the command line: Python ez_setup.py

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 ez_setup.py. This bootloader will download the latest version of Setuptools to install, and can also update the local setuptools.

$ wget http://peak.telecommunity.com/dist/ez_setup.py

$ sudo python ez_setup.py

Update Setuptools:

sudo python ez_setup.py-u setuptools

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

$ wget Https://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg

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

Method Three: Source code compilation and installation

$wget https://pypi.python.org/packages/source/s/setuptools/setuptools-5.7.tar.gz

$ tar zxvf setuptools-5.7.tar.gz

$ CD setuptools-5.7

$ python setup.py Install

$ wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz

$ tar zxvf setuptools-0.6c11.tar.gz

$ CD SETUPTOOLS-0.6C11

$ python setup.py 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 setup.py install

3) If Easy_install install a module is wrong, you can download it yourself to http://pypi.python.org/simple/python-ldap/, and then use the Python setup.py install.

How to install the Easy_install command:

1. Download Setuptools:

wget Https://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11.win32-py2.6.exe

2, Installation Setuptlls

3. Test Easy_install command

Easy_install--help

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:

Https://github.com/ipython/ipython/downloads

Http://pypi.python.org/pypi/pyreadline

Http://pypi.python.org/pypi/setuptools#downloads

$ python setup.py Install

2. Binary package: Yum install Ipython

3, Easy_install:

Http://pypi.python.org/pypi/setuptools

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

Or

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

Problem one: I can't find python.h

$ yum-y Install Python-devel

Unloading

Rpm-e Python-setuptools

# #Install Ipython:

$ Easy_install Ipython

4 , Pip (recommended)

1.1 Install Setuptools First

$wget https://pypi.python.org/packages/source/s/setuptools/setuptools-5.7.tar.gz

$ tar zxvf setuptools-5.7.tar.gz

$ CD setuptools-5.7

$ python setup.py Install

1.2 Re-install PIP

$ easy_install pip

Or

# # Install Pip

$ wget https://bootstrap.pypa.io/get-pip.py

$ sudo python get-pip.py

Or

$ wget https://pypi.python.org/packages/source/p/pip/pip-1.5.6.tar.gz

$ tar zxvf pip-1.5.6.tar.gz

$ CD pip-1.5.6

$ python setup.py 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

Attention:

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

Or

$ 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: http://ipython.org/

# Centos

sudo yum install Python-ipython-notebook

# Debian/ubuntu

sudo apt-get install Ipython-notebook

$ wget https://pypi.python.org/packages/source/i/ipython/ipython-2.2.0.tar.gz

$ tar zxvf ipython-2.2.0.tar.gz

$ CD ipython-2.2.0

$ sudo python setup.py 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

Https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz

Pythonbrew

This article is from the "Technology Life" blog, please be sure to keep this source http://gnucto.blog.51cto.com/3391516/1663511

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: info-contact@alibabacloud.com 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.