// wget
[root@wode006 tools]# wget https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip
--2015-07-05 02:02:51-- https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip
正在解析主机 pypi.python.org (pypi.python.org)... 103.245.222.223
正在连接 pypi.python.org (pypi.python.org)|103.245.222.223|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:108935 (106K) [application/octet-stream]
正在保存至: “MySQL-python-1.2.5.zip”
100%[======================================>] 108,935 581KB/s 用时 0.2s
2015-07-05 02:02:52 (581 KB/s) - 已保存 “MySQL-python-1.2.5.zip” [108935/108935])
[root@wode006 tools]# ls
get-pip.py jieba-0.24.zip MySQL-python-1.2.5.zip
jieba-0.24mysql-community-release-el7-5.noarch.rpm
[root@wode006 tools]#
// unzip
[root@wode006 tools]# unzip MySQL-python-1.2.5.zip
Archive: MySQL-python-1.2.5.zip
inflating: MySQL-python-1.2.5/GPL-2.0
inflating: MySQL-python-1.2.5/HISTORY
inflating: MySQL-python-1.2.5/INSTALL
inflating: MySQL-python-1.2.5/MANIFEST.in
inflating: MySQL-python-1.2.5/metadata.cfg
inflating: MySQL-python-1.2.5/PKG-INFO
inflating: MySQL-python-1.2.5/pymemcompat.h
inflating: MySQL-python-1.2.5/README.md
inflating: MySQL-python-1.2.5/setup.cfg
inflating: MySQL-python-1.2.5/setup.py
inflating: MySQL-python-1.2.5/setup_common.py
inflating: MySQL-python-1.2.5/setup_posix.py
inflating: MySQL-python-1.2.5/setup_windows.py
inflating: MySQL-python-1.2.5/site.cfg
inflating: MySQL-python-1.2.5/_mysql.c
inflating: MySQL-python-1.2.5/_mysql_exceptions.py
inflating: MySQL-python-1.2.5/doc/conf.py
inflating: MySQL-python-1.2.5/doc/FAQ.rst
inflating: MySQL-python-1.2.5/doc/index.rst
inflating: MySQL-python-1.2.5/doc/modules.rst
inflating: MySQL-python-1.2.5/doc/MySQLdb.constants.rst
inflating: MySQL-python-1.2.5/doc/MySQLdb.rst
inflating: MySQL-python-1.2.5/doc/user_guide.rst
inflating: MySQL-python-1.2.5/doc/_mysql.rst
inflating: MySQL-python-1.2.5/doc/_mysql_exceptions.rst
inflating: MySQL-python-1.2.5/doc/_build/_sources/distribute_setup.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/FAQ.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/index.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/modules.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/MySQLdb.constants.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/MySQLdb.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/setup.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/setup_common.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/setup_posix.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/setup_windows.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/user_guide.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/_mysql.txt
inflating: MySQL-python-1.2.5/doc/_build/_sources/_mysql_exceptions.txt
inflating: MySQL-python-1.2.5/MySQLdb/connections.py
inflating: MySQL-python-1.2.5/MySQLdb/converters.py
inflating: MySQL-python-1.2.5/MySQLdb/cursors.py
inflating: MySQL-python-1.2.5/MySQLdb/release.py
inflating: MySQL-python-1.2.5/MySQLdb/times.py
inflating: MySQL-python-1.2.5/MySQLdb/__init__.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/CLIENT.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/CR.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/ER.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/FIELD_TYPE.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/FLAG.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/REFRESH.py
inflating: MySQL-python-1.2.5/MySQLdb/constants/__init__.py
inflating: MySQL-python-1.2.5/MySQL_python.egg-info/dependency_links.txt
inflating: MySQL-python-1.2.5/MySQL_python.egg-info/PKG-INFO
inflating: MySQL-python-1.2.5/MySQL_python.egg-info/SOURCES.txt
inflating: MySQL-python-1.2.5/MySQL_python.egg-info/top_level.txt
inflating: MySQL-python-1.2.5/tests/capabilities.py
inflating: MySQL-python-1.2.5/tests/configdb.py
inflating: MySQL-python-1.2.5/tests/dbapi20.py
inflating: MySQL-python-1.2.5/tests/test_MySQLdb_capabilities.py
inflating: MySQL-python-1.2.5/tests/test_MySQLdb_dbapi20.py
inflating: MySQL-python-1.2.5/tests/test_MySQLdb_nonstandard.py
[root@wode006 tools]# ls
get-pip.py jieba-0.24.zip MySQL-python-1.2.5
jieba-0.24mysql-community-release-el7-5.noarch.rpmMySQL-python-1.2.5.zip
[root@wode006 tools]# cd MySQL-python-1.2.5/
[root@wode006 MySQL-python-1.2.5]# ls
doc MANIFEST.in _mysql_exceptions.py README.md setup.py
GPL-2.0 metadata.cfg MySQL_python.egg-info setup.cfg setup_windows.py
HISTORY _mysql.c PKG-INFO setup_common.py site.cfg
INSTALL MySQLdb pymemcompat.h setup_posix.py tests
[root@wode006 MySQL-python-1.2.5]#
// build
# python setup.py build
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying _mysql_exceptions.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/converters.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/connections.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/cursors.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
copying MySQLdb/times.py -> build/lib.linux-x86_64-2.7/MySQLdb
creating build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/__init__.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/REFRESH.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.linux-x86_64-2.7/MySQLdb/constants
running build_ext
building '_mysql' extension
creating build/temp.linux-x86_64-2.7
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
_mysql.c:29:20: 致命错误:Python.h:没有那个文件或目录
#include "Python.h"
^
编译中断。
error: command 'gcc' failed with exit status 1
[root@wode006 MySQL-python-1.2.5]#
// install python-devel
[root@wode006 MySQL-python-1.2.5]# yum install python-devel
已加载插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 python-devel.x86_64.0.2.7.5-18.el7_1.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
python-devel x86_64 2.7.5-18.el7_1.1 updates 389 k
事务概要
================================================================================
安装 1 软件包
总下载量:389 k
安装大小:1.0 M
Is this ok [y/d/N]: y
Downloading packages:
python-devel-2.7.5-18.el7_1.1.x86_64.rpm | 389 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : python-devel-2.7.5-18.el7_1.1.x86_64 1/1
验证中 : python-devel-2.7.5-18.el7_1.1.x86_64 1/1
已安装:
python-devel.x86_64 0:2.7.5-18.el7_1.1
完毕!
[root@wode006 MySQL-python-1.2.5]#
// build again
[root@wode006 MySQL-python-1.2.5]# python setup.py build
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Dversion_info=(1,2,5,'final',1) -D__version__=1.2.5 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -g -m64 -fPIC -g -fabi-version=2 -fno-omit-frame-pointer -fno-strict-aliasing
In file included from/usr/include/mysql/my_config.h:27:0,
from _mysql.c:44:
/usr/include/mysql/my_config_x86_64.h:442:0:警告:“HAVE_WCSCOLL”重定义 [默认启用]
#define HAVE_WCSCOLL
^
In file included from/usr/include/python2.7/pyconfig.h:6:0,
from/usr/include/python2.7/Python.h:8,
from _mysql.c:29:
/usr/include/python2.7/pyconfig-64.h:908:0:附注:这是先前定义的位置
#define HAVE_WCSCOLL 1
^
gcc -pthread -shared -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib64/mysql -L/usr/lib64 -lmysqlclient -lpthread -lm -ldl -lpython2.7 -o build/lib.linux-x86_64-2.7/_mysql.so
[root@wode006 MySQL-python-1.2.5]#
// install
[root@wode006 MySQL-python-1.2.5]# python setup.py install
running install
running bdist_egg
running egg_info
writing MySQL_python.egg-info/PKG-INFO
writing top-level names to MySQL_python.egg-info/top_level.txt
writing dependency_links to MySQL_python.egg-info/dependency_links.txt
reading manifest file 'MySQL_python.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'MySQL_python.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-2.7/MySQLdb
running build_ext
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
copying build/lib.linux-x86_64-2.7/_mysql_exceptions.py -> build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/converters.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/connections.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/cursors.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/MySQLdb/times.py -> build/bdist.linux-x86_64/egg/MySQLdb
creating build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/__init__.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CR.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FIELD_TYPE.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/ER.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/FLAG.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/REFRESH.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/constants/CLIENT.py -> build/bdist.linux-x86_64/egg/MySQLdb/constants
copying build/lib.linux-x86_64-2.7/MySQLdb/release.py -> build/bdist.linux-x86_64/egg/MySQLdb
copying build/lib.linux-x86_64-2.7/_mysql.so -> build/bdist.linux-x86_64/egg
byte-compiling build/bdist.linux-x86_64/egg/_mysql_exceptions.py to _mysql_exceptions.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/converters.py to converters.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/connections.py to connections.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/cursors.py to cursors.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/times.py to times.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CR.py to CR.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FIELD_TYPE.py to FIELD_TYPE.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/ER.py to ER.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/FLAG.py to FLAG.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/REFRESH.py to REFRESH.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/constants/CLIENT.py to CLIENT.pyc
byte-compiling build/bdist.linux-x86_64/egg/MySQLdb/release.py to release.pyc
creating stub loader for _mysql.so
byte-compiling build/bdist.linux-x86_64/egg/_mysql.py to _mysql.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying MySQL_python.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
writing build/bdist.linux-x86_64/egg/EGG-INFO/native_libs.txt
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/MySQL_python-1.2.5-py2.7-linux-x86_64.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing MySQL_python-1.2.5-py2.7-linux-x86_64.egg
Copying MySQL_python-1.2.5-py2.7-linux-x86_64.egg to /usr/lib64/python2.7/site-packages
Adding MySQL-python 1.2.5 to easy-install.pth file
Installed /usr/lib64/python2.7/site-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg
Processing dependencies for MySQL-python==1.2.5
Finished processing dependencies for MySQL-python==1.2.5
[root@wode006 MySQL-python-1.2.5]#