码迷,mamicode.com
首页 > 编程语言 > 详细

mac命令行切换python版本

时间:2020-05-05 11:02:41      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:name   技术   default   term   path   llvm   lan   apple   -objc   

brew安装anaconda3

brew cask install anaconda3

安装之后打开路径查看:/usr/local/anaconda3/bin
技术图片


anaconda3环境变量设置

vim ~/.zshrc

export PATH=/usr/local/anaconda3/bin:$PATH

source ~/.zshrc

验证

conda --version
# 看到版本好就成功了

安装双版本

conda create --name python2 python=2.7

conda create --name python3 python=3.7

查看目录 /usr/local/anaconda3/envs/
技术图片


python环境变量设置

export PATH="/usr/local/anaconda3/envs/python3:$PATH"

# 重新加载一下系统环境变量
. ~/.zshrc
?  ~ python2

WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using ‘python3‘ from within Terminal.

Python 2.7.16 (default, Dec 13 2019, 18:00:32)
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.32.4) (-macos10.15-objc-s on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>



?  ~ python3
Python 3.7.6 (default, Jan  8 2020, 13:42:34)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

参考

https://www.cnblogs.com/zhoulin1234/p/9893055.html

mac命令行切换python版本

标签:name   技术   default   term   path   llvm   lan   apple   -objc   

原文地址:https://www.cnblogs.com/mysticbinary/p/12829569.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!