zoukankan      html  css  js  c++  java
  • mac 上面安装mysql-python

    安装过程中一直报错:

    EnvironmentError: mysql_config not found

     

    最终下面的方式解决:

     


    58down voteaccepted
    +200

    Ok, well, first of all, let me check if I am on the same page as you:

    • You installed python
    • You did brew install mysql
    • You did export PATH=$PATH:/usr/local/mysql/bin
    • And finally, you did pip install MySQL-Python

    If you did all those steps in the same order, and you still got an error, read on to the end, if, however, you did not follow these exact steps try, following them from the very beginning.

    So, you followed the steps, and you're still geting an error, well, there are a few things you could try:

    1. Try running which mysql-config from bash. It probably won't be found. That's why the build isn't finding it either. Try running locate mysql-config and see if anything comes back. The path to this binary needs to be either in your shell's $PATH environment variable, or it needs to be explicitly in the setup.py file for the module assuming it's looking in some specific place for that file.

    2. Instead of using MySQL-Python, try using 'mysql-connector-python', it can be installed using pip install mysql-connector-python. More information on this can be found here andhere.

    3. Manually find the location of 'mysql/bin', 'mysql_config', and 'MySQL-Python', and add all these to the $PATH environment variable.

    4. If all above steps fail, then you could try installing 'mysql' using MacPorts, in which case the file 'mysql_config' would actually be called 'mysql_config5', and in this case, you would have to do this after installing: export PATH=$PATH:/opt/local/lib/mysql5/bin. You can find more details here.

    Note1: I've seen some people saying that installing python-dev and libmysqlclient-dev also helped, however I do not know if these packages are available on Mac OS.

    Note2: Also, make sure to try running the commands as root.

    I got my answers from (besides my brain) these places (maybe you could have a look at them, to see if it would help): 1234.

    I hoped I helped, and would be happy to know if any of this worked, or not. Good luck.

  • 相关阅读:
    数据库面试题
    MySQL表的导入
    MySQL表的导出
    MySQL安装mydumper
    MySQL中的日志
    动态数组实现下压栈
    动态数组
    设计模式之迭代器
    设计模式之组合模式
    设计模式之状态模式
  • 原文地址:https://www.cnblogs.com/doudouyoutang/p/4673969.html
Copyright © 2011-2022 走看看