{"id":132,"date":"2023-07-14T11:02:53","date_gmt":"2023-07-14T03:02:53","guid":{"rendered":"https:\/\/i.u-ch.com\/?p=132"},"modified":"2023-07-14T11:41:21","modified_gmt":"2023-07-14T03:41:21","slug":"%e5%9c%a8mac%e4%b8%8a%e8%bd%bb%e6%9d%be%e7%ae%a1%e7%90%86python%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/i.u-ch.com\/?p=132","title":{"rendered":"\u5728Mac\u4e0a\u8f7b\u677e\u7ba1\u7406Python\u7248\u672c"},"content":{"rendered":"\n<p>1\uff09\u5b89\u88c5pyenv<\/p>\n\n\n\n<p><code>brew install pyenv<\/code><\/p>\n\n\n\n<p>2\uff09\u5b89\u88c5python2<br><code>pyenv install 2.7.18<\/code><\/p>\n\n\n\n<p>bash\u73af\u5883\u914d\u7f6e\uff1a<\/p>\n\n\n\n<p><code>echo 'export PYENV_ROOT=\"$HOME\/.pyenv\"' >> ~\/.bash_profile<br>echo 'export PATH=\"$PYENV_ROOT\/bin:$PATH\"' >> ~\/.bash_profile<br>echo -e 'if command -v pyenv 1>\/dev\/null 2>&amp;1; then\\n eval \"$(pyenv init -)\"\\nfi' >> ~\/.bash_profile<br><\/code><\/p>\n\n\n\n<p>3\uff09\u8bbe\u7f6e\u5168\u5c40\u9ed8\u8ba4<br><code>pyenv global 2.7.18<\/code><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>\u8865\u5145\uff1a<\/p>\n\n\n\n<p>\u67e5\u627e\u53ef\u4ee5\u5b89\u88c5\u7684Python\u7248\u672c\uff1a<br><code>pyenv install -l<\/code><\/p>\n\n\n\n<p>\u5b89\u88c5\u67d0\u4e2a\u7248\u672c\u7684Python\uff0c\u59823.6.11\uff1a<br><code>pyenv install 3.6.11<\/code><\/p>\n\n\n\n<p>\u67e5\u770b\u5df2\u7ecf\u5b89\u88c5\u4e86\u54ea\u4e9b\u7248\u672c\u7684python<br><code>pyenv versions<\/code><\/p>\n\n\n\n<p>\u67e5\u770b\u73b0\u5728\u5168\u5c40\u9ed8\u8ba4\u7684python\u7684\u7248\u672c<br><code>pyenv global<\/code><\/p>\n\n\n\n<p>\u5207\u6362\u5168\u5c40\u9ed8\u8ba4\u7684python\u7684\u7248\u672c<br><code>pyenv global 3.6.11<\/code><\/p>\n\n\n\n<p>Zsh\u73af\u5883\u914d\u7f6e<br><code>echo 'export PYENV_ROOT=\"$HOME\/.pyenv\"' &gt;&gt; ~\/.zshrc<br>echo 'export PATH=\"$PYENV_ROOT\/bin:$PATH\"' &gt;&gt; ~\/.zshrc<br>echo -e 'if command -v pyenv 1&gt;\/dev\/null 2&gt;&amp;1; then\\n eval \"$(pyenv init -)\"\\nfi' &gt;&gt; ~\/.zshrc<\/code><\/p>\n\n\n\n<p>Fish shell\u73af\u5883\u914d\u7f6e<br><code>set -Ux PYENV_ROOT $HOME\/.pyenv<br>set -Ux fish_user_paths $PYENV_ROOT\/bin $fish_user_paths<br>echo -e '\\n\\n# pyenv init\\nif command -v pyenv 1&gt;\/dev\/null 2&gt;&amp;1\\n pyenv init - | source\\nend' &gt;&gt; ~\/.config\/fish\/config.fish<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\uff09\u5b89\u88c5pyenv brew install pyenv 2\uff09\u5b89\u88c5python2pyenv install 2 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/i.u-ch.com\/index.php?rest_route=\/wp\/v2\/posts\/132"}],"collection":[{"href":"https:\/\/i.u-ch.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i.u-ch.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i.u-ch.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i.u-ch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=132"}],"version-history":[{"count":9,"href":"https:\/\/i.u-ch.com\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions"}],"predecessor-version":[{"id":151,"href":"https:\/\/i.u-ch.com\/index.php?rest_route=\/wp\/v2\/posts\/132\/revisions\/151"}],"wp:attachment":[{"href":"https:\/\/i.u-ch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=132"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i.u-ch.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=132"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i.u-ch.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=132"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}