pycharm 安装 flask mysqldb 错误,求解

2016-04-26 12:04:49 +08:00
 Gary_Cheung
提示如下:
OSError: mysql_config not found

给出的 proposed solution :
Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5'.

pycharm 需要 pip 8.1.1 ,已经更新,应该不是 pip 版本问题。
应该是配置文件 mysql_config 的问题,安装时只提示 not found ,实在不知道怎么解决 T_T
6153 次点击
所在节点    Python
6 条回复
kungfuchicken
2016-04-26 12:07:49 +08:00
export PATH=$PATH:/usr/local/mysql/bin

/usr/local/mysql/bin 是你 MySQL 的安装路径

pip install MySQL-Python
Gary_Cheung
2016-04-26 12:35:24 +08:00
@kungfuchicken 抛了个错误如下

bash-3.2$ export PATH=$PATH:/usr/local/mysql/bin
bash-3.2$ pip install MySQL-Python
---------------------------------------------------
Collecting MySQL-Python
/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/connection.py:266: SubjectAltNameWarning: Certificate for pypi.python.org has no `subjectAltName`, falling back to check for a `commonName` for now. This feature is being removed by major browsers and deprecated by RFC 2818. (See https://github.com/shazow/urllib3/issues/497 for details.)
SubjectAltNameWarning
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-931zi2ld/MySQL-Python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/tmp/pip-build-931zi2ld/MySQL-Python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-931zi2ld/MySQL-Python/
----------------------------------------------------

[问题]: python setup.py egg_info 是什么东东? 发现好多错误和它有关
gotounix
2016-04-26 13:20:09 +08:00
sudo apt-get install mysql-server libmysqld-dev
kungfuchicken
2016-04-26 13:44:14 +08:00
@Gary_Cheung 忘了 MySQL-Python 不支持 Python3, 在 Python3 下装 mysqlclient 替代吧

pip install mysqlclient
caomaocao
2016-04-26 14:05:56 +08:00
是不是 os x 10.10 以后?~ 这之后的加了个权限的什么我记不清了, 要打开 os x 的 root 权限再开下啥的。以前查了好久
julyclyde
2016-04-26 20:05:26 +08:00
setup.py egg_info 是让安装包自己输出一些信息,供进一步分析使用
你这 python 居然不带 ConfigParser ?然后我看了看路径, 3.5 的
告诉你: MySQLdb 不支持 python3

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/274461

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX