{"id":6212,"date":"2017-06-01T10:56:59","date_gmt":"2017-06-01T02:56:59","guid":{"rendered":"https:\/\/kyle.ai\/blog\/?p=6212"},"modified":"2017-06-01T10:57:52","modified_gmt":"2017-06-01T02:57:52","slug":"%e5%9c%a8macos%e4%b8%ad%e5%ae%89%e8%a3%85mysql-python","status":"publish","type":"post","link":"https:\/\/kyle.ai\/blog\/6212.html","title":{"rendered":"\u5728macOS\u4e2d\u5b89\u88c5MySQL-python"},"content":{"rendered":"<p>\u6362\u8fc7\u4e00\u6b21mac\u7535\u8111\uff0c\u6bcf\u6b21\u5b89\u88c5\u8fd9\u4e2a\u4f9d\u8d56\u7684\u65f6\u5019\u90fd\u4f1a\u6298\u817e\u534a\u5929\uff0c\u6240\u4ee5\u7eaa\u5f55\u4e0b\u6765\u3002<\/p>\n<p>\u9996\u5148\u53c2\u8003\u8fd9\u91cc\uff1ahttps:\/\/stackoverflow.com\/questions\/25459386\/mac-os-x-environmenterror-mysql-config-not-found<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nbrew install mysql\r\nexport PATH=$PATH:\/usr\/local\/mysql\/bin\r\npip install MySQL-Python\r\n<\/pre>\n<p>\u7136\u540e\u53ef\u80fd\u9047\u5230\u4e00\u4e9b\u62a5\u9519\uff0c\u8bf4\u4ec0\u4e48\u5e93\u4f9d\u8d56\u4e0d\u5b58\u5728\u4e4b\u7c7b\u7684\uff0c\u6240\u4ee5\u89e3\u51b3\u529e\u6cd5\u662f\u9700\u8981\u5b89\u88c5XCode\u3002<\/p>\n<p>\u5b89\u88c5\u597dXCode\u4e4b\u540e\uff0c\u518d\u5b89\u88c5\u547d\u4ee4\u884c\u5de5\u5177\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nxcode-select --install\r\n<\/pre>\n<p>\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u67e5\u770b\u5b89\u88c5\u6210\u529f\u6ca1\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nxcode-select --print-path\r\n<\/pre>\n<p>\u8fd9\u4e9b\u6b65\u9aa4\u90fd\u5b8c\u6210\u540e\uff0c\u6211\u8fd8\u662f\u9047\u5230\u4e00\u4e2a\u62a5\u9519\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n    clang -bundle -undefined dynamic_lookup -isysroot \r\n\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/MacOSX.platform\/Developer\/SDKs\/MacOSX10.12.sdk \r\nbuild\/temp.macosx-10.12-x86_64-2.7\/_mysql.o -L\/usr\/local\/Cellar\/mysql\/5.7.18_1\/lib \r\n-lmysqlclient -lssl -lcrypto -o build\/lib.macosx-10.12-x86_64-2.7\/_mysql.so\r\n    ld: library not found for -lssl\r\n<\/pre>\n<p>\u4ee5\u4e3a\u662f openssl\u5e93\u6ca1\u6709\u5b89\u88c5\uff0cbrew install openssl\u540e\uff0c\u95ee\u9898\u4f9d\u65e7\u3002<\/p>\n<p>\u6700\u540e\u662f\u53c2\u7167\u8fd9\u91cc\u7684\u7b54\u6848\uff1ahttps:\/\/stackoverflow.com\/questions\/26288042\/error-installing-psycopg2-library-not-found-for-lssl\/39244687#39244687<\/p>\n<p>\u6267\u884c<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nenv LDFLAGS=&quot;-I\/usr\/local\/opt\/openssl\/include -L\/usr\/local\/opt\/openssl\/lib&quot; pip install MySQL-Python\r\n<\/pre>\n<p>\u7ec8\u4e8e\u901a\u8fc7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6362\u8fc7\u4e00\u6b21mac\u7535\u8111\uff0c\u6bcf\u6b21\u5b89\u88c5\u8fd9\u4e2a\u4f9d\u8d56\u7684\u65f6\u5019\u90fd\u4f1a\u6298\u817e\u534a\u5929\uff0c\u6240\u4ee5\u7eaa\u5f55\u4e0b\u6765\u3002 \u9996\u5148\u53c2\u8003\u8fd9\u91cc\uff1ahttps:\/\/stac [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-6212","post","type-post","status-publish","format-standard","hentry","category-skill"],"_links":{"self":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/comments?post=6212"}],"version-history":[{"count":2,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6212\/revisions"}],"predecessor-version":[{"id":6214,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/posts\/6212\/revisions\/6214"}],"wp:attachment":[{"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/media?parent=6212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/categories?post=6212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kyle.ai\/blog\/wp-json\/wp\/v2\/tags?post=6212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}