{"id":286,"date":"2013-10-15T18:14:49","date_gmt":"2013-10-16T01:14:49","guid":{"rendered":"http:\/\/www.lorrin.org\/blog\/?p=286"},"modified":"2013-10-30T23:08:32","modified_gmt":"2013-10-31T06:08:32","slug":"mysql_config-not-found","status":"publish","type":"post","link":"https:\/\/www.lorrin.org\/blog\/2013\/10\/15\/mysql_config-not-found\/","title":{"rendered":"&#8220;mysql_config not found&#8221; installing MySQL-python with MacPorts"},"content":{"rendered":"<p>UPDATE 2013-10-16: Macports now has a <tt>mysql_select<\/tt> package that cleanly solves this problem. Run the following and then pip will be able to find <tt>mysql_config<\/tt> without issue.<\/p>\n<pre class=\"brush:text\">sudo port install mysql_select\r\nsudo port select mysql mysql56<\/pre>\n<hr \/>\n<p>Using <tt>pip<\/tt> to install <a href=\"http:\/\/mysql-python.sourceforge.net\/MySQLdb.html\">MySQL-python<\/a> (aka <tt>MySQLdb<\/tt>) gives the error &#8220;<b><tt>EnvironmentError: mysql_config not found<\/tt><\/b>&#8221; when run on a system where MySQL has been installed via <a href=\"https:\/\/www.macports.org\/\">MacPorts<\/a>. The solution is to tell the installer where <tt>mysql_config<\/tt> can be found by <b>appending &#8220;<tt>mysql_config = \/opt\/local\/bin\/mysql_config5<\/tt>&#8221; to <tt>site.cfg<\/tt><\/b>. Assuming use of <a href=\"https:\/\/github.com\/bernardofire\/virtualenvwrapper\">virtualenvwrapper<\/a> (<a href=\"http:\/\/www.lorrin.org\/blog\/2013\/10\/15\/virtualenvwrapper-recipe\/\">highly recommended!<\/a>):<\/p>\n<pre class=\"brush:text\">pip install --no-install MySQL-python\r\n... ignore errors ...\r\nVENV=$(dirname $(dirname $(which python))); echo \"mysql_config = \/opt\/local\/bin\/mysql_config5\" &gt;&gt; $VENV\/build\/MySQL-python\/site.cfg\r\npip install --no-download MySQL-python<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE 2013-10-16: Macports now has a mysql_select package that cleanly solves this problem. Run the following and then pip will be able to find mysql_config without issue. sudo port install mysql_select sudo port select mysql mysql56 Using pip to install MySQL-python (aka MySQLdb) gives the error &#8220;EnvironmentError: mysql_config not found&#8221; when run on a system <a href='https:\/\/www.lorrin.org\/blog\/2013\/10\/15\/mysql_config-not-found\/' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[37],"tags":[85,86,87,11,84],"_links":{"self":[{"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/posts\/286"}],"collection":[{"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/comments?post=286"}],"version-history":[{"count":8,"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/posts\/286\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/posts\/286\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/media?parent=286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/categories?post=286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lorrin.org\/blog\/wp-json\/wp\/v2\/tags?post=286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}