Python 如何使用 Conda 安装 MySQLdb?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34140472/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I use Conda to install MySQLdb?
提问by James Eaves
I've read several different explanation regarding how to install MySQLdb, but I'm not sure which case applies to me since my error message is different. My system can't seem to find MySQLdb. I installed pymysql, but i need to import MySQLdb to use procedures from that library.
我已经阅读了几种关于如何安装 MySQLdb 的不同解释,但我不确定哪种情况适用于我,因为我的错误消息是不同的。我的系统似乎找不到 MySQLdb。我安装了 pymysql,但我需要导入 MySQLdb 才能使用该库中的过程。
Thanks for your help.
谢谢你的帮助。
$ conda install MySQLdb
Fetching package metadata: .... Error: No packages found in current osx-64 channels matching: mysqldb
正在获取包元数据:.... 错误:在当前 osx-64 通道中找不到匹配的包:mysqldb
Did you mean one of these?
你是说其中之一吗?
pymysql
You can search for this package on anaconda.org with
你可以在 anaconda.org 上搜索这个包
anaconda search -t conda mysqldb
$ anaconda search -t conda mysqldb
Using anaconda-server api site https://api.anaconda.orgRun 'anaconda show ' to get more details:
No packages found
Name | Version | Package Types | Platforms
------------------------- | ------ | --------------- | ---------------
Found 0 packages
使用 anaconda-server api 站点https://api.anaconda.org运行“anaconda show”以获取更多详细信息:未找到包名称 | 版本 | 包装类型 | 平台
------------------------- | ------ | --------------- | --------------- 找到 0 个包
采纳答案by Stefan
You could either fall back on pip install
:
你可以依靠pip install
:
pip install mysql-python
or, if there are issues with pip
as in your case, use a binstar
package like so:
或者,如果pip
您的情况有问题,请使用如下所示的binstar
包:
conda install binstar
binstar search -t conda mysql-python
and then conda install -c
a matching package.
然后conda install -c
是匹配的包。
回答by maverik
Try to use this command:
尝试使用此命令:
conda install mysql-python
回答by Bassem Shahin
To install this package with conda run:
要使用 conda 安装此软件包,请运行:
conda install -c anaconda mysql-python=1.2.5
check here: https://anaconda.org/anaconda/mysql-python
回答by Mao-Wei Nilsson
~/anaconda2$ conda install mysql-python
~/anaconda2$ conda install mysql-python
works on ubuntu 16.04
适用于 ubuntu 16.04
回答by kumar Gaurav
try this:
尝试这个:
conda install mysql-connector-python
回答by WillMonge
For those Googlers in 2018+, you can install from the bioconda channel
对于 2018+ 年的 Google 员工,您可以从bioconda 频道安装
conda install -c bioconda mysqlclient
回答by Adam Erickson
For Anaconda Python, @StephenRauch has the correct solution, as it is officially supported in the Anaconda Enterprise documentation:
对于 Anaconda Python,@StephenRauch 有正确的解决方案,因为它在 Anaconda Enterprise 文档中得到了官方支持:
conda install -c anaconda mysql-connector-python
Reference: https://enterprise-docs.anaconda.com/en/latest/data-science-workflows/data/mysql.html
参考:https: //enterprise-docs.anaconda.com/en/latest/data-science-workflows/data/mysql.html