1,查看当前python 版本
python -v 小写v:这是版本信息,包括库版本 python -V 大写v:只看python的版本
which python3 查看安装路径
2,修改~/.bash_profile文件
# Setting PATH for Python 3.8 # The orginal version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}" export PATH ### //增加这几行内容(如有则无需添加)
alias python2='/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'
alias python3='/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'
alias python=python3
3,使得修改的 bash_profile文件 生效
source ~/.bash_profile
其他
引用格式:
from 包名.文件名 import 类名
4. 安装包到python3下
pip3 install XXXX
python3 -m pip install ****