VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > temp > 简明python教程 >
  • mac命令行切换python版本

brew安装anaconda3#


	
Copy
brew cask install anaconda3

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

anaconda3环境变量设置#


	
Copy
vim ~/.zshrc export PATH=/usr/local/anaconda3/bin:$PATH source ~/.zshrc

验证


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

安装双版本#


	
Copy
conda create --name python2 python=2.7 conda create --name python3 python=3.7

查看目录 /usr/local/anaconda3/envs/

命令后切换python环境#


	
Copy
# 查看本地的py环境 ➜ ~ conda info -e # conda environments: # base * /usr/local/anaconda3 python2 /usr/local/anaconda3/envs/python2 python27 /usr/local/anaconda3/envs/python27 python3 /usr/local/anaconda3/envs/python3 # 进入py版本 ➜ ~ source activate python27 (python27) ➜ ~ # 退出py版本 conda deactivate

pip#

进入py版本之后,有时候不知道pip把安装包安装到哪里了,用这个方法很好使:


	
Copy
(python27) ➜ ~ python Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 17:44:47) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import requests >>> requests <module 'requests' from '/usr/local/anaconda3/envs/python27/lib/python2.7/site-packages/requests/__init__.pyc'>

/usr/local/anaconda3/envs/python27/lib/python2.7/site-packages/requests/ 就是了。

ide vscode set#

参考#

https://www.cnblogs.com/zhoulin1234/p/9893055.html https://blog.csdn.net/ninnyyan/article/details/80485507

如果文章对你有帮助,可以给文章评论、点推荐哦 Github:https://github.com/Mysticbinary

相关教程