设为首页 收藏本站
查看: 939|回复: 0

[经验分享] 【Python】安装MySQL-python-1.2.5

[复制链接]

尚未签到

发表于 2018-8-3 12:07:38 | 显示全部楼层 |阅读模式
  // 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.24  mysql-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.24  mysql-community-release-el7-5.noarch.rpm  MySQL-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>  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]#

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-545908-1-1.html 上篇帖子: Python 学习笔记 (3)—— python异常处理 下篇帖子: Python获取网卡信息(名称、MAC、IP、网关等)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表