{"id":383,"date":"2013-03-15T12:15:43","date_gmt":"2013-03-15T16:15:43","guid":{"rendered":"http:\/\/zhanxw.com\/blog\/?p=383"},"modified":"2013-03-15T19:21:32","modified_gmt":"2013-03-15T23:21:32","slug":"%e7%94%a8pip%e5%ae%89%e8%a3%85matplotlib-mac","status":"publish","type":"post","link":"https:\/\/zhanxw.com\/blog\/2013\/03\/%e7%94%a8pip%e5%ae%89%e8%a3%85matplotlib-mac\/","title":{"rendered":"\u7528pip\u5b89\u88c5Matplotlib (Mac)"},"content":{"rendered":"<p>Install matplotlib using pip (Mac)<\/p>\n<p>\u5728Mac OSX\u4e0b\u5b89\u88c5matplotlib\u5e76\u4e0d\u7b80\u5355 \uff08\u6bd4\u5982Linux\u53ef\u4ee5\u7528apt-get\uff0cWindows\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7dBinary build\uff09\uff0c\u56e0\u4e3amatplotlib\u9700\u8981\u4e00\u4e9b\u5e95\u5c42\u5e93(\u4f8b\u5982freetype\uff0cpygtk\uff0c\u800cpygtk\u53c8\u9700\u8981gobject, gobject\u9700\u8981cairo\uff09\u3002<\/p>\n<p>\u8fd9\u91cc\u603b\u7ed3\u4e00\u4e0b\u6211\u5728Mac OSX\u4e0b\u5b89\u88c5Matplotlib\u7684\u7ecf\u9a8c\u3002<\/p>\n<p>\u9996\u5148\u5b89\u88c5MacPorts\uff0c\u5177\u4f53\u53c2\u89c1<a href=\"http:\/\/www.macports.org\/install.php\" title=\"Install MacPorts\" target=\"_blank\">Install MacPorts<\/a>.<\/p>\n<p>\u7136\u540e\u5b89\u88c5py27-pygtk<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n port install py27-pygtk\r\n<\/pre>\n<p>\u7136\u540e\u628apygtk\u7684\u8def\u5f84\u6dfb\u52a0\u5230PYTHONPATH\u91cc\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nexport PYTHONPATH=$PYTHONPATH:\/opt\/local\/\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/\r\n<\/pre>\n<p>\u6700\u540e\u7528pip\u5b89\u88c5<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nalias pipInstall='pip install  --install-option=&quot;--prefix=\/Users\/zhanxw\/python&quot; '\r\nexport CC=\/opt\/local\/bin\/g++; export CFLAGS=; export LDFLAGS= ; pipInstall -U matplotlib\r\n<\/pre>\n<p>\u8fd9\u91cc\u8981\u6307\u5b9aGCC\u7f16\u8bd1\u5668\u7684\u8def\u5f84\uff0c\u5426\u5219\u7cfb\u7edf\u9ed8\u8ba4\u7528gcc 4.2\u7248\u7f16\u8bd1\u3002<br \/>\n\u8fd8\u9700\u8981\u6e05\u9664CFLAG\u548cLDFLAGS\uff0c\u4e0d\u7136\u5b89\u88c5\u7684\u65f6\u5019\u4e0d\u7528pkg-config\uff0c\u4e5f\u5c31\u5f97\u4e0d\u5230gtk\u5e93\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002<\/p>\n<p>\u989d\u5916\u4e24\u4e2atip\uff1a<\/p>\n<p>\u30101\u3011 \u5b89\u88c5pip\u9700\u8981\u5148\u5b89\u88c5setuptools<br \/>\n\u30102\u3011 \u4e00\u4e2a\u547d\u4ee4\u5347\u7ea7\u6240\u6709pip\u5b89\u88c5\u7684\u8f6f\u4ef6\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\n  pip freeze --local | grep -v '^\\-e' | cut -d = -f 1  | xargs pip install -U\r\n<\/pre>\n<p>\u6b64\u5916\u5982\u4f55\u5728Mac OSX\u4e0b\u7528\u6e90\u7801\u5b89\u88c5numpy\u548cscipy\uff1f<br \/>\n\u8fd9\u91cc\u6709\u5b98\u7f51\u7684<a href=\"http:\/\/www.scipy.org\/Installing_SciPy\/Mac_OS_X\" target=\"_blank\">\u8bf4\u660e<\/a>\u3002<br \/>\n\u7279\u522b\u6ce8\u610f\u7684\u662f\uff0c\u7f16\u8bd1numpy\u548cscipy\u8981\u7528gcc 4.0\u7248\u3002<br \/>\n\u53e6\u5916scipy\u8fd8\u9700\u8981cython \uff08pip install cython\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install matplotlib using pip (Mac) \u5728Mac OSX\u4e0b\u5b89\u88c5matplotlib\u5e76\u4e0d\u7b80\u5355 \uff08\u6bd4\u5982Linux\u53ef\u4ee5\u7528apt-get\uff0cWindows\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7dBinary build\uff09\uff0c\u56e0\u4e3amatplotlib\u9700\u8981\u4e00\u4e9b\u5e95\u5c42\u5e93(\u4f8b\u5982freetype\uff0cpygtk\uff0c\u800cpygtk\u53c8\u9700\u8981gobject, gobject\u9700\u8981cairo\uff09\u3002 \u8fd9\u91cc\u603b\u7ed3\u4e00\u4e0b\u6211\u5728Mac OSX\u4e0b\u5b89\u88c5Matplotlib\u7684\u7ecf\u9a8c\u3002 \u9996\u5148\u5b89\u88c5MacPorts\uff0c\u5177\u4f53\u53c2\u89c1Install MacPorts. \u7136\u540e\u5b89\u88c5py27-pygtk port install py27-pygtk \u7136\u540e\u628apygtk\u7684\u8def\u5f84\u6dfb\u52a0\u5230PYTHONPATH\u91cc\uff1a export PYTHONPATH=$PYTHONPATH:\/opt\/local\/\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/lib\/python2.7\/site-packages\/ \u6700\u540e\u7528pip\u5b89\u88c5 alias pipInstall=&#8217;pip install &#8211;install-option=&quot;&#8211;prefix=\/Users\/zhanxw\/python&quot; &#8216; export CC=\/opt\/local\/bin\/g++; export CFLAGS=; export LDFLAGS= ; pipInstall -U matplotlib \u8fd9\u91cc\u8981\u6307\u5b9aGCC\u7f16\u8bd1\u5668\u7684\u8def\u5f84\uff0c\u5426\u5219\u7cfb\u7edf\u9ed8\u8ba4\u7528gcc 4.2\u7248\u7f16\u8bd1\u3002 \u8fd8\u9700\u8981\u6e05\u9664CFLAG\u548cLDFLAGS\uff0c\u4e0d\u7136\u5b89\u88c5\u7684\u65f6\u5019\u4e0d\u7528pkg-config\uff0c\u4e5f\u5c31\u5f97\u4e0d\u5230gtk\u5e93\u6587\u4ef6\u7684\u4f4d\u7f6e\u3002 \u989d\u5916\u4e24\u4e2atip\uff1a \u30101\u3011 \u5b89\u88c5pip\u9700\u8981\u5148\u5b89\u88c5setuptools \u30102\u3011 \u4e00\u4e2a\u547d\u4ee4\u5347\u7ea7\u6240\u6709pip\u5b89\u88c5\u7684\u8f6f\u4ef6\uff1a pip freeze &#8211;local | grep -v &#8216;^\\-e&#8217; | cut -d [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[99,100,53],"class_list":["post-383","post","type-post","status-publish","format-standard","hentry","category-sysadmin","tag-matplotlib","tag-pip","tag-python"],"_links":{"self":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts\/383","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/comments?post=383"}],"version-history":[{"count":0,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts\/383\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/media?parent=383"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/categories?post=383"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/tags?post=383"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}