2013-06-04 32 views
1

安装完毕后,我可以连接到一个普通的MySQL数据库,而不是那些与SSL - 为后来我收到以下错误:如何通过setuptools安装支持SSL的MySQL-python?

File "build/bdist.linux-x86_64/egg/MySQLdb/__init__.py" in Connect 
    74.  return Connection(*args, **kwargs) 
File "build/bdist.linux-x86_64/egg/MySQLdb/connections.py" in __init__ 
    170.   super(Connection, self).__init__(*args, **kwargs2) 

Exception Type: NotSupportedError at /shop/free_license/ 
Exception Value: client library does not have SSL support 

里面我setup.py。我有

from setuptools import setup 

setup(
    ..., 
    install_requires = [ 'MySQL-python == 1.2.2' ], 
    dependency_links = [ 
     'http://downloads.sourceforge.net/project/mysql-python/mysql-python/1.2.2/MySQL-python-1.2.2.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmysql-python%2Ffiles%2Fmysql-python%2F1.2.2%2F&ts=1370248965&use_mirror=surfnet', 
    ] 
) 

即使我尝试在没有指定dependency_links的情况下安装1.2.4,也会失败。

我有头文件安装sudo apt-get install libssl-dev

我的版本是:

$ uname -a 
Linux devzsoldosp 2.6.32-33-generiC#72-Ubuntu SMP Fri Jul 29 21:07:13 UTC 2011 x86_64 GNU/Linux 
$ python 
Python 2.6.5 (r265:79063, Oct 1 2012, 22:04:36) 
[GCC 4.4.3] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import setuptools 
>>> setuptools.__version__ 
'0.6c11' 
>>> 

的virtualenv中是用virtualenv testsetuptools命令初始化。当数据库连接通过sudo apt-get install python-mysqldb # 1.2.2-10build1 安装时,相同的mysql版本,SSL连接在同一台机器上工作。

我还需要做些什么才能移动到基于setuptools的安装?

回答

0

验证你的MySQL客户端支持SSL:

mysql --ssl --help 

与同为服务器:

mysql -u root -p 
mysql> show variables like "%ssl%"; 

按照说明建立安全连接:http://dev.mysql.com/doc/refman/5.1/en/ssl-connections.html

这里有关如何使用Python库创建与MySQL的SSL连接的更多信息:http://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html

python-mysqldb中存在一个问题1.2.3-1build1:https://bugs.launchpad.net/ubuntu/+source/python-mysqldb/+bug/1027075

+0

感谢您的回答!如上所述,事情的mysql方面是可以的,所以通过全局的,Ubuntu安装的python-mysqldb包运行相同的示例代码。我会看看1.2.3版本,但由于我使用的是旧版本,我最初的假设是,这不是问题(但会重复检查,我以前错了:)) – zsepi

+0

您能展示我你的Python代码? – Glaslos