在python的侧面安装中安装mysql连接器(除了默认的python安装之外)
我有一台linux CENTOS 6.6服务器,默认情况下安装了python2.6.6 我需要python版本的2.7,但由于各种系统原因,CENTOS 6.6需要提供默认的python2.6.6安装(yum依赖于2.6.6) 因此,我在单独的位置(/usr/local/lib/python2.7/)安装了python 2.7。现在我正在尝试在2.7版本中安装我在python2.6.6中使用的所有软件包 我在python2.6.6中安装了mysql连接器库,它是使用.rpm文件从以下位置安装的:在python的侧面安装中安装mysql连接器(除了默认的python安装之外),python,mysql,mysql-connector,mysql-connector-python,Python,Mysql,Mysql Connector,Mysql Connector Python,我有一台linux CENTOS 6.6服务器,默认情况下安装了python2.6.6 我需要python版本的2.7,但由于各种系统原因,CENTOS 6.6需要提供默认的python2.6.6安装(yum依赖于2.6.6) 因此,我在单独的位置(/usr/local/lib/python2.7/)安装了python 2.7。现在我正在尝试在2.7版本中安装我在python2.6.6中使用的所有软件包 我在python2.6.6中安装了mysql连接器库,它是使用.rpm文件从以下位置安装的:
https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html
Installing Connector/Python on Linux Using an RPM Package
Connector/Python Linux RPM packages (.rpm files) are available from the Connector/Python download site (see Section 4.1, “Obtaining Connector/Python”).
To install a Connector/Python RPM package (denoted here as PACKAGE.rpm), use this command:
shell> rpm -i PACKAGE.rpm
To install the C Extension (available as of Connector/Python 2.1.1), install the corresponding package with “cext” in the package name.
RPM provides a feature to verify the integrity and authenticity of packages before installing them. To learn more, see Verifying Package Integrity Using MD5 Checksums or GnuPG.
我不确定如何安装mysql连接器库,以便python2.7能够识别安装
我注意到python2.6.6中的mysql连接器库。(默认)安装位于以下位置:
/usr/lib/python2.6/site-packages/mysql/
/usr/lib/python2.6/site-packages/mysql_connector_python-1.1.5-py2.6.egg-info
解决方案是简单地将mysql目录和egg信息文件复制并重命名到/usr/local/lib/python2.7/site packages/
,还是需要执行其他步骤
我不确定一个副本能否解决这个问题,因为mysql目录有\uuuu init\uuuu.pyc
和\uuuu init\uuuu.pyo
文件,这些文件的路径特定于python2.6.6,并且可能在安装过程中生成。步骤如下:
1) re-download the package from `https://dev.mysql.com`
2) untar the `mysql-connector-python-1.1.4.tar.gz`
3) cd into mysql-connector-python-1.1.4
4) envoke `python2.7 setup.py install`
这就是你需要做的