在Mac/win10上将Python 3设置为默认

which python3
alias python=/usr/bin/python3

pip3同理。 pip3更换为国内镜像

pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/ 升级pip版本:

sudo pip install --upgrade pip

win 将Python 3设置为默认: 1.在cmd中输入命令: where python,可以查看python安装的位置以及版本号 2.在高级系统设置—系统环境变量—Path,点击右下角的"编辑" 3.Python3的Path选中—>点击右侧的"上移",即可将Python3环境变量上移到前面,这样默认的就会是Python3了! 注意!!! 1.python3安装目录下的Scripts也需要添加进系统设置中,这样就可以用pip3 2.上移后将之前的cmd关闭,再重新打开一个cmd,输入python,才能看到是否切换到Python3啦?

经验分享 程序员 微信小程序 职场和发展