{"id":86,"date":"2020-02-16T10:03:50","date_gmt":"2020-02-16T10:03:50","guid":{"rendered":"http:\/\/115.29.150.138\/?p=86"},"modified":"2020-02-16T10:03:50","modified_gmt":"2020-02-16T10:03:50","slug":"mac%e7%b3%bb%e7%bb%9fpython%e7%8e%af%e5%a2%83%e8%ae%be%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/jeezy.cn\/index.php\/2020\/02\/16\/mac%e7%b3%bb%e7%bb%9fpython%e7%8e%af%e5%a2%83%e8%ae%be%e7%bd%ae\/","title":{"rendered":"mac\u7cfb\u7edfpython\u73af\u5883\u8bbe\u7f6e"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u95ee\u9898<\/h3>\n\n\n\n<p>MAC\u4e0b\uff0c\u7cfb\u7edf\u9ed8\u8ba4python\u7248\u672c\u4e3a2.7\u3002\u867d\u7136macOS\u4e00\u76f4\u5728\u5347\u7ea7\uff0c\u4f46\u4e0d\u77e5\u4e3a\u4f55\u5bf9\u5185\u6838\u5185\u5efa\u7684python\u5374\u4e0d\u4e0e\u65f6\u4ff1\u8fdb\u3002\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\u9700\u8981\u5bfc\u5165\u7684\u6a21\u5757\uff0cPython2.7\u90fd\u4e0d\u652f\u6301\uff0c\u6240\u4ee5\u5fc5\u987b\u5b89\u88c5\u6700\u65b0\u7248\u3002\u5728Python\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u7684\u5305\u53ea\u662f\u4e2aidle\uff0c\u5e76\u4e0d\u66ff\u6362\u5185\u6838\uff0c\u56e0\u6b64\uff0c\u9700\u8981\u5bf9\u5185\u6838\u8fdb\u884c\u66f4\u6539\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u88c5conda<\/h3>\n\n\n\n<p>\u4ece\u7f51\u7edc\u4e0b\u8f7dconda\uff0c\u53ef\u4ee5\u4e0b\u8f7danaconda\uff0c\u4e5f\u53ef\u4ee5\u4e0b\u8f7dminiconda\uff0c\u5982\u679c\u662f\u56fe\u5f62\u754c\u9762\uff0c\u64cd\u4f5c\u7b80\u5355\uff0c\u7167\u7740\u6267\u884c\u5373\u53ef\u3002<br>\n\u5982\u679c\u662f\u811a\u672c\u6587\u4ef6 .SH\uff0c\u5c31\u9700\u8981\u6253\u5f00\u7ec8\u7aef\uff0c\u8fd0\u884c<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>bash Anaconda2-4.3.1-MacOS-x86_64.sh<\/p><\/blockquote>\n\n\n\n<p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u4f1a\u63d0\u793a\u5b89\u88c5\u76ee\u5f55\uff0c\u8bb0\u4f4f\u8be5\u76ee\u5f55\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u8fd0\u884c<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>export PATH=~\/anaconda2\/bin:$PATH<\/p><\/blockquote>\n\n\n\n<p>\u7528\u5b89\u88c5\u8fc7\u7a0b\u4e2d\u786e\u8ba4\u7684\u76ee\u5f55\u66ff\u6362\u5e26\u4e0b\u5212\u7ebf\u7684\u90e8\u5206\u3002<br>\n\u81f3\u6b64conda\u5c31\u5b89\u88c5\u5b8c\u6bd5\u4e86\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u88c5python\u9ad8\u7248\u672c<\/h3>\n\n\n\n<p>\u5728\u7ec8\u7aef\u754c\u9762\u4e0b\uff0c\u8f93\u5165<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda info -e<\/p><\/blockquote>\n\n\n\n<p>\u4f1a\u770b\u5230\u7cfb\u7edf\u5df2\u6709\u7684python\u53ea\u6709\u4e00\u4e2a2.7\u7248\u672c\u3002\u4f7f\u7528\u4e0b\u9762\u547d\u4ee4\u5b89\u88c53.7\u7248\u672c\u7684python<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda create -n py37 python=3.7<\/p><\/blockquote>\n\n\n\n<p>\u7f51\u7edc\u6b63\u5e38\u60c5\u51b5\u4e0b\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u4e0b\u5217\u547d\u4ee4\uff0c\u5728bash\u4e2d\u521d\u59cb\u5316\u521a\u624d\u5b89\u88c5\u7684\u73af\u5883\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda init py37<\/p><\/blockquote>\n\n\n\n<p>\u5b8c\u6210\u540e\uff0c\u91cd\u542f\u7ec8\u7aef\uff0c\u5c06\u7cfb\u7edf\u9ed8\u8ba4\u7684python\u73af\u5883\u8c03\u6574\u4e3a\u6211\u4eec\u521a\u624d\u5b89\u88c5\u76843.7\u7248\u672c\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda activate py37<\/p><\/blockquote>\n\n\n\n<p>bash\u547d\u4ee4\u884c\u6700\u524d\u9762\u62ec\u53f7\u91cc\u73b0\u5728\u5e94\u8be5\u663e\u793a\u7684\u5c31\u662fpy37\u3002<br>\nconda\u8fd8\u6709\u8bb8\u591a\u547d\u4ee4\uff0c\u53c2\u8003\u5982\u4e0b\uff1a<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">conda\u7684\u73af\u5883\u7ba1\u7406<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda info -e  \u67e5\u770b\u5f53\u524d\u5df2\u5b89\u88c5\u7684\u73af\u5883<br>\n  conda create -n py27 python=2.7  \u6dfb\u52a02.7\u7248\u672c\u7684Python\u73af\u5883<br>\n  conda activate py27  \u5207\u6362\u5230Python2.7\u73af\u5883<br>\n  conda deactivate  \u8fd4\u56de\u9ed8\u8ba4\u7684Python\u73af\u5883<br>\n  conda remove -n py27 &#8211;all  \u5220\u9664\u5df2\u5b89\u88c5\u7684Python\u73af\u5883<\/p><\/blockquote>\n\n\n\n<h4 class=\"wp-block-heading\">conda\u7684\u5305\u7ba1\u7406\uff0c\u7c7b\u4f3cPython\u7684pip<\/h4>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda list\u3000 \u67e5\u770b\u5f53\u524d\u73af\u5883\u4e0b\u5df2\u5b89\u88c5\u7684\u5305<br>\n  conda list -n py27\u3000 \u67e5\u770b\u6307\u5b9a\u73af\u5883\u7684\u5df2\u5b89\u88c5\u7684\u5305<br>\n  conda search selenium  \u67e5\u627epackage\u4fe1\u606f<br>\n  conda install -n py27 selenium  \u6307\u5b9a\u73af\u5883\u5b89\u88c5package\uff0c\u4e0d\u52a0-n\u5219\u5b89\u88c5\u5728\u5f53\u524d\u6d3b\u8dc3\u73af\u5883<br>\n  conda update -n py27 selenium  \u6307\u5b9a\u73af\u5883\u66f4\u65b0package\uff0c\u4e0d\u52a0-n\u5219\u66f4\u65b0\u5728\u5f53\u524d\u6d3b\u8dc3\u73af\u5883<br>\n  conda remove -n py27 selenium  \u5220\u9664package\uff0c\u4e0d\u52a0-n\u5219\u5220\u9664\u5728\u5f53\u524d\u6d3b\u8dc3\u73af\u5883<\/p><\/blockquote>\n\n\n\n<p>conda\u5c06conda\u3001python\u7b49\u90fd\u89c6\u4e3apackage\uff0c\u56e0\u6b64\u53ef\u4ee5\u4f7f\u7528conda\u7ba1\u7406conda\u548cpython\u7684\u7248\u672c<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda update conda  \u3000 \u66f4\u65b0conda<br>\n  conda update anaconda  \u66f4\u65b0anaconda<br>\n  conda update python   \u66f4\u65b0python\uff0c\u5047\u8bbe\u5f53\u524d\u73af\u5883\u662f3.6\uff0c\u5219\u66f4\u65b03.6.x\u7cfb\u5217\u7248\u672c<\/p><\/blockquote>\n\n\n\n<p>anconda\u7684\u9ed8\u8ba4\u73af\u5883\u4f1a\u5b89\u88c5anconda\u7684\u5305\u96c6\u5408\uff0c\u65b0\u6dfb\u52a0\u7684Python\u73af\u5883\u53ea\u4f1a\u5b89\u88c5\u76f8\u5173\u7684\u5fc5\u987b\u9879\uff0c\u5982python\u3001pip\u7b49\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u8981\u4f7f\u7528anconda\u7684\u96c6\u5408\u5305\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>conda install anaconda  \u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000 \u5728\u5f53\u524d\u73af\u5883\u4e0b\u5b89\u88c5anaconda\u5305\u96c6\u5408<br>\n  conda create -n py27 python=2.7 anaconda  \u3000\u3000 \u5728\u521b\u5efa\u73af\u5883\u7684\u540c\u65f6\u5b89\u88c5anaconda\u96c6\u5408\u5305<\/p><\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u88c5python\u6a21\u5757<\/h3>\n\n\n\n<p>\u6b64\u5904\u4ee5pygame\u4e3a\u4f8b\u3002<br>\nconda\u7a0b\u5e8f\u91cc\u5305\u542b\u4e86pip\u7a0b\u5e8f\uff0c\u8fd0\u884c\u547d\u4ee4\uff0c\u5b89\u88c5pygame\u6a21\u5757\u3002<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>pip install pygame<\/p><\/blockquote>\n\n\n\n<p>ok\u4e86\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8c03\u6574vs code\u8c03\u7528\u7684python\u7248\u672c<\/h3>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"http:\/\/115.29.150.138\/wp-content\/uploads\/2020\/02\/image.png\" alt=\"\u622a\u5c4f2019-12-07\u4e0b\u53487.17.15.png\" class=\"wp-image-87\"\/><\/figure>\n\n\n\n<p>\u6253\u5f00visual studio code\uff08v1.40.1\u4e3a\u4f8b\uff09\uff0c\u6dfb\u52a0\u6269\u5c55\uff08Extensions)\uff0cpython\u3002<br>\n\u5728vs code\u7684\u8bbe\u7f6e\u4e2d\uff0c\u67e5\u627epythonpath\uff0c\u627e\u5230\u8fd9\u4e2a\u9009\u9879\u540e\uff0c\u8f93\u51653.7\u7248\u672cpython\u7684\u76ee\u5f55\u3002<br>\n<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">vs code\u65e0\u6cd5\u5728\u53ea\u8bfb\u7f16\u8f91\u5668\u4e2d\u8f93\u5165<\/h4>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/img-blog.csdnimg.cn\/20190121084118946.png\" alt=\"image\"\/><\/figure>\n\n\n\n<p>\u5728\u8bbe\u7f6e\u4e2d\u67e5\u627e\u201cRun in Terminal\u201d\uff0c\u5c06\u4e0b\u9762\u7684\u9009\u9879\u6253\u52fe\u5373\u53ef\u3002<br>\n<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u8c03\u6574aptana\u8c03\u7528\u7684python\u7248\u672c<\/h3>\n\n\n\n<p>\u6253\u5f00aptana3\uff0c\u6b64\u5904\u8ba4\u4e3aaptana\u5df2\u7ecf\u914d\u7f6e\u597dpydev\u73af\u5883\u3002<br>\n\u6253\u5f00\u5c5e\u6027\uff0c\u4f9d\u6b21\u70b9\u5f00\u201cPyDev-Interpreters-Python Interpreter&#8221;,\u5728\u53f3\u4fa7\u9009\u62e9\u201dBrowse for python\/pypy.exe&#8221;\u6216\u8005\u201cnew\u201d\uff0c\u9009\u62e9conda\u76ee\u5f55\u4e0b\uff0cenvs\/py37\u91cc\u5b89\u88c5\u76843.7\u7248\u672cpython\u3002\u6dfb\u52a0\u540e\uff0c\u5728\u4e0b\u9762\u9009\u62e9pip\u5b89\u88c5\uff0c\u8f93\u5165\u201cinstall pygame\u201d\uff0c\u8fd0\u884c\u540e\uff0c\u5b8c\u6210\u5b89\u88c5\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898 MAC\u4e0b\uff0c\u7cfb\u7edf\u9ed8\u8ba4python\u7248\u672c\u4e3a2.7\u3002\u867d\u7136macOS\u4e00\u76f4\u5728\u5347\u7ea7\uff0c\u4f46\u4e0d\u77e5\u4e3a\u4f55\u5bf9\u5185\u6838\u5185\u5efa\u7684python &#8230; <a title=\"mac\u7cfb\u7edfpython\u73af\u5883\u8bbe\u7f6e\" class=\"read-more\" href=\"https:\/\/jeezy.cn\/index.php\/2020\/02\/16\/mac%e7%b3%bb%e7%bb%9fpython%e7%8e%af%e5%a2%83%e8%ae%be%e7%bd%ae\/\" aria-label=\"\u9605\u8bfb mac\u7cfb\u7edfpython\u73af\u5883\u8bbe\u7f6e\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[13,14],"class_list":["post-86","post","type-post","status-publish","format-standard","hentry","category-knowledge","tag-mac","tag-python"],"_links":{"self":[{"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/posts\/86","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/comments?post=86"}],"version-history":[{"count":0,"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/posts\/86\/revisions"}],"wp:attachment":[{"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/media?parent=86"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/categories?post=86"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jeezy.cn\/index.php\/wp-json\/wp\/v2\/tags?post=86"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}