V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Gary_Cheung
V2EX  ›  Python

pycharm 安装 flask mysqldb 错误,求解

  •  
  •   Gary_Cheung · 2016-04-26 12:04:49 +08:00 · 6296 次点击
    这是一个创建于 3162 天前的主题,其中的信息可能已经有所发展或是发生改变。
    提示如下:
    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
    6 条回复    2016-04-26 20:05:26 +08:00
    kungfuchicken
        1
    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
        2
    Gary_Cheung  
    OP
       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
        3
    gotounix  
       2016-04-26 13:20:09 +08:00
    sudo apt-get install mysql-server libmysqld-dev
    kungfuchicken
        4
    kungfuchicken  
       2016-04-26 13:44:14 +08:00   ❤️ 1
    @Gary_Cheung 忘了 MySQL-Python 不支持 Python3, 在 Python3 下装 mysqlclient 替代吧

    pip install mysqlclient
    caomaocao
        5
    caomaocao  
       2016-04-26 14:05:56 +08:00
    是不是 os x 10.10 以后?~ 这之后的加了个权限的什么我记不清了, 要打开 os x 的 root 权限再开下啥的。以前查了好久
    julyclyde
        6
    julyclyde  
       2016-04-26 20:05:26 +08:00
    setup.py egg_info 是让安装包自己输出一些信息,供进一步分析使用
    你这 python 居然不带 ConfigParser ?然后我看了看路径, 3.5 的
    告诉你: MySQLdb 不支持 python3
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2968 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 13:10 · PVG 21:10 · LAX 05:10 · JFK 08:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.