From the person who sells the balloon, each child took a wish;--North
From each child, we installed our own shadow. --Little Q
---------------------------------------------------------------------------------------------------
"Installation Method"
Method 1: Single-File Installation
Copy the file directly to the $python _dir/lib//path as follows
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8B/04/wKioL1hCTyzA-DbaAACV03j6C18394.png "title=" 1.png " Style= "width:603px;height:350px;" alt= "Wkiol1hctyza-dbaaacv03j6c18394.png" width= "603" vspace= "0" hspace= "0" Height = "Border=" "0"/>
Method 2: Multi-file installation with setup.py
Download the module package, unzip it, go to the module folder, execute:
Python setup.py Build
Python setup.py Install
Method 3:easy_install Way
Download ez_setup.py First, run Python ez_setup to install the Easy_install tool
You can then use Easy_install to install the package.
Easy_install PackageName
Easy_install Package.egg
Method 4:pip Way
The installation of the PIP tool: Easy_install pip (pip Mount Easy_install, and will also be loaded into the Scripts folder. )
http://beibing.blog.51cto.com/10693373/1774252
Install: Pip Install PackageName
Update: Pip install-u packagename
Removal: Pip Uninstall PackageName
Search: Pip Search PackageName
"Install MySQL for example"
Detects if there is a MySQL module, python>>>import the following error is not present
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/8B/08/wKiom1hCUYaDGEJaAAAdcAm0R-U883.png "title=" 2.png " Style= "WIDTH:603PX;HEIGHT:104PX;" alt= "Wkiom1hcuyadgejaaaadcam0r-u883.png" width= "603" vspace= "0" hspace= "0" Height = "104" border= "0"/>
SOURCE Installation :
wget http://sourceforge.net/projects/mysql-python/files/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz
Unzip the----into the directory
Python setup.py Build
Python setup.py Install
Error:command ' gcc ' failed with exit status 1
Workaround: Yum installs GCC python-devel or installs Mysql-devel extensions
Error:EnvironmentError:mysql_config not found
Workaround: Locate Mysql_config: Find/-name Mysql_config
Then modify the setup_posix.py file to point mysql_config.prth= "" to the absolute path
Error:python.h:no such file or directory
Workaround: Yum installs python-devel because the system does not have a development version of Python installed
Error:/usr/bin/ld:cannot Find-lz, resulting in compilation errors
Solution: Yum Install Zlib-devel
---------------------------------------------
Recommended: Pip Install Mysql-python
---------------------------------------------
"Making the installation package"
Although the Python module can be copied and installed, it is generally recommended to make the installation package, which is to write a setup.py file to install.
The setup.py file is used as follows:
% python setup.py build #编译
% python setup.py install #安装
% python setup.py sdist #制作分发包
% python setup.py bdist_wininst #制作windows下的分发包
The main implementation of a setup function in setup.py, most of which is descriptive, the most important is the packages parameter, lists all the package, you can use their own find_packages to dynamically obtain the package. In fact, setup.py writing is very simple.
A simple example:
setup.py file:
From Setuptools Import Setup, Find_packagessetup (name = "MyTest", Version = "0.10", Description = "My test Module", author = "Robin Hood", url = "http://www.csdn.net", license = "LGPL", Packages = Find_packages (), scripts = ["scripts/test.py"],)
mytest.py
Import Sysdef get (): Return Sys.path
scripts/test.py
Import Osprint Os.environ.keys ()
The scripts in setup indicates that the file is placed in the Python scripts directory and can be used directly. OK, a simple installation succeeds, you can run the commands listed to build the installation package, or install the Python package. Native test succeeded (WIN32-PYTHON25)!
-----------------------------------------------------------------------------------------------
Note: Setuptools tool installation Method
(method i). Use ez_setup.py to install Setuptools
into https://pypi.python.org/pypi/setuptools download ez_setup.py
This is Setuptools A proud installation that requires a script of about 8K to automatically install many Python packages, including the setuptools itself, for the user. ez_setup.py In this way, the user can download and install the appropriate Setuptools egg file for the current Python version of the user by simply downloading and running ez_setup.py (of course, the user needs Python 2.3.5 or more, 64-bit OS users need Python version 2.4 or higher). In addition, the script installs the executable Easy_install script to a location where the user's operating system Python executable scripts should be installed (for example, Windows users are installed in the Scripts directory in the Python installation directory).
For more detailed instructions and precautions on this installation method, please refer to the official instructions (see extended reading). The simple installation command is as follows: Wget-q ez_setup.py
(Method Two). Install Setuptools using the full installation package
Of course, users can also install them directly using the Setuptools release version. This is also a handy way for users who use Windows, and many of the official package management repositories for Linux distributions contain a version of Setuptools. For example, if you're using Ubuntu the same way as I do, installing setuptools is simply doing the following:
# Apt-get Install Python-setuptools
Install Easy_install package-name, such as Easy_install Pylab
Uninstall Easy_install-m Package-name, such as easy_install-m Pylab//But to manually delete legacy files after uninstallation
Setuptools It can automatically install the module, just need you to give it a module name can be, and automatically help you solve the module dependency problem. In general, the modules installed with Setuptools will automatically be placed in a directory with a suffix of. Egg.
In Windows, easy_install This command in the Python installation directory under the scripts, so you need to add scripts to the environment variable path, so it is more convenient to use, Linux does not need to pay attention to this problem.
This article is from the "North Ice--q" blog, please be sure to keep this source http://beibing.blog.51cto.com/10693373/1879112
Python--Module installation