如何通过pip安装mysql-connector-python(开发版本)? [英] How do you install mysql-connector-python (development version) through pip?
问题描述
我正在尝试获得对MySQL的支持,但是我无法获得不同的连接器工作。我一直使用mysql-connector-python与django 1.7,并希望继续使用它。
开发版本的mysql-connector-python(2.1.2)似乎现在支持Django 1.8。
如何使用pip install(在我的virtualenv内)安装开发版本?我尝试运行以下命令:
pip install mysql-connector-python == 2.1.2 --allow-external mysql -connector-python
但2.1.2开发人员版本不可用:
找不到满足要求的版本mysql-connector-python == 2.1.2(从版本:1.1.4,1.1.5, 1.1.6,1.2.2,1.2.3,2.0.1,2.0.2,2.0.3,2.0.4)
一些不安全和不可验证的文件被忽略(使用--allow-unverified mysql-connector- python允许)。
找不到匹配的发行版mysql-connector-python == 2.1.2
我有尝试直接从下载文件: http://dev.mysql.com/downloads/connector/python /
...但由于某种原因安装后,我的virtualenv中没有连接器
帮助请:-)谢谢。
'
编辑:
我尝试过
pip install mysql- python
但它不支持Python 3.4
我同意,debian包似乎是破解为至少Ubuntu 14.04。
apt-get版本和pip版本不包括2.1.x版本。
为了完成这个工作,我不得不抓住来源:
$ git clone https:// github。 com / mysql / mysql-connector-python.git
$ cd mysql-connector-python
$ python ./setup.py build
$ sudo python ./setup.py install
...
>>>将mysql.connector导入为msc
>>> msc .__ version__
'2.1.3'
>>>
I have a virtualenv in which I am running Django 1.8 with Python 3.4
I am trying to get support for MySQL however I am having trouble getting the different connectors to work. I have always used mysql-connector-python with django 1.7 and would like to continue using it.
The development version of mysql-connector-python (2.1.2) seems to have support for Django 1.8 now.
How do I install the development version using pip install (within my virtualenv)? I have tried running the following command:
pip install mysql-connector-python==2.1.2 --allow-external mysql-connector-python
but the 2.1.2 developer version is not available there:
could not find a version that satisfies the requirement mysql-connector-python==2.1.2 (from versions: 1.1.4, 1.1.5, 1.1.6, 1.2.2, 1.2.3, 2.0.1, 2.0.2, 2.0.3, 2.0.4)
Some insecure and unverifiable files were ignored (use --allow-unverified mysql-connector-python to allow).
No matching distribution found for mysql-connector-python==2.1.2
I have tried downloading the file directly from: http://dev.mysql.com/downloads/connector/python/
...but for some reason after installation the connector is not available within my virtualenv
Help please :-) Thank you. '
EDIT:
I have tried
pip install mysql-python
but it is not supported by Python 3.4
I agree, the debian packages appear to be broken for at least Ubuntu 14.04.
The apt-get version and the pip version do not include the 2.1.x releases.
To get it done, I had to grab the source:
$ git clone https://github.com/mysql/mysql-connector-python.git
$ cd mysql-connector-python
$ python ./setup.py build
$ sudo python ./setup.py install
...
>>> import mysql.connector as msc
>>> msc.__version__
'2.1.3'
>>>
这篇关于如何通过pip安装mysql-connector-python(开发版本)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!