问题
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.
Thanks for your help.
$ conda install MySQLdb
Fetching package metadata: .... Error: No packages found in current osx-64 channels matching: mysqldb
Did you mean one of these?
pymysql
You can search for this package on anaconda.org with
anaconda search -t conda mysqldb
$ anaconda search -t conda mysqldb
Using anaconda-server api site https://api.anaconda.org
Run 'anaconda show ' to get more details:
No packages found
Name | Version | Package Types | Platforms
------------------------- | ------ | --------------- | ---------------
Found 0 packages
回答1:
You could either fall back on pip install
:
pip install mysql-python
or, if there are issues with pip
as in your case, use a binstar
package like so:
conda install binstar
binstar search -t conda mysql-python
and then conda install -c
a matching package.
回答2:
Try to use this command:
conda install mysql-python
回答3:
For those Googlers in 2018+, you can install from the bioconda channel
conda install -c bioconda mysqlclient
回答4:
To install this package with conda run:
conda install -c anaconda mysql-python=1.2.5
check here: https://anaconda.org/anaconda/mysql-python
回答5:
try this:
conda install mysql-connector-python
回答6:
~/anaconda2$ conda install mysql-python
works on ubuntu 16.04
回答7:
For Anaconda Python, @StephenRauch has the correct solution, as it is officially supported in the Anaconda Enterprise documentation:
conda install -c anaconda mysql-connector-python
Reference: https://enterprise-docs.anaconda.com/en/latest/data-science-workflows/data/mysql.html
来源:https://stackoverflow.com/questions/34140472/how-can-i-use-conda-to-install-mysqldb