mysql python is not installed_MySQL-python安装后在python中可以运行,在ipython中提示找不到module?...

最后换了一个MIT出的mysql接口pymysql,问题解决,流程如下:

Anaconda comes with the conda installer, so use conda instead of pip. This works for all packages that are available for conda. There are MySQL packages available, you can select them from https://docs.continuum.io/anaconda/pkg-docs.

For pymysql you open up the command line, call 'conda install pymysql' and watch the magic unfold.

There is of course a trade-off (for the not-gurus like me at least): there are also packages that are not available for conda. tweepy is one of those. On the other hand, I did not manage to get sklearn installed using pip after uninstalling anaconda as suggested in the other answer.

[Edit:]I could install tweepy after searching on https://anaconda.org

[Edit, in response on question:] @scottlittle,you mean something like:

# -*- coding: utf-8 -*-

# imports

import pymysql

# open connection to the database

conn = pymysql.connect(host='localhost',

port=3306,

user='',

passwd='',

db='',

charset='utf8')

cur = conn.cursor()

sql = "SELECT * FROM "

cur.execute(sql)

# close connection to the database

cur.close()

conn.close( )

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值