Installing MySQL-python on OSX failing due to miss

2019-09-14 17:23发布

I'm attempting to install MySQL-python on OSX so a program I'm writing can talk to our work database to run and get back query results.

I've run into this error explaining that there is a missing mysql_config somewhere. I've come across some other StackOverflow answers but they are geared toward Linux environments.

I've also done a brew install mysql but brew link mysql is failing. I suspect the issue might being right here.

Collecting mysql-python
/Library/Python/2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 110kB 1.8MB/s
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 20, in <module>
      File "/private/tmp/pip-build-ev74Js/mysql-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-ev74Js/mysql-python

标签: python mysql pip
1条回答
\"骚年 ilove
2楼-- · 2019-09-14 18:13

It appears you don't have write permissions for /usr/local, resulting in homebrew failing to link. If you're on OS X 10.11+ there's a good chance that it's reset all the permissions, which you need to change in order to remedy the issue; first try letting homebrew fix things:

Troubleshooting Homebrew:

  1. Run brew update (twice).
  2. Run brew doctor and fix all the warnings.

Take Ownership:

If things fail with permissions errors, check the permissions in /usr/local, or perhaps use:

sudo chown -R $(whoami) /usr/local

Homebrew Troubleshooting document | El Capitan and Homebrew document

查看更多
登录 后发表回答