系统python 版本为3.8.5
使用conda 创建Python==3.7.12的环境tensorflow1后,调用时仍为3.8.5。
(tensorflow1) Rachel1900 (master #) ~ $ which python /Users/Rachel1900/anaconda3/envs/tensorflow1/bin/python #路径正确 (tensorflow1) Rachel1900 (master #) ~ $ python --version Python 3.8.5 #版本错误
需要通过bashrc进行配置
Rachel1900 (master #) ~ $ conda activate tensorflow1 (tensorflow1) Rachel1900 (master #) ~ $ open .bashrc
.bashrc为空,写入alias python="/Users/Rachel1900/anaconda3/envs/tensorflow1/bin/python" ,
保存,运行,验证
(tensorflow1) Rachel1900 (master #) ~ $ source .bashrc (tensorflow1) Rachel1900 (master #) ~ $ python --version Python 3.7.12 (tensorflow1) Rachel1900 (master #) ~ $参考
- 什么是bashrc配置文件,如何对其进行编辑



