首页 > 编程语言 >mac os python安装问题

mac os python安装问题

时间:2022-10-13 20:14:12浏览次数:54  
标签:bin python Python mac PATH 3.10 os 环境变量

首先直接下载官网安装包安装

https://www.python.org/downloads/

 

然后配置环境变量

# 打开 ~/.bash_profile
vim ~/.bash_profile

# 写入环境变量,保存
export PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:${PATH}"
alias python="/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"

# 令环境变量生效
source ~/.bash_profile

 

如果是新的mac系统,关闭终端重新打开时,需要再次运行source才能使用python

此时需要修改~/.zshrc

# 打开 ~/.zshrc
vim ~/.zshrc

# 写入环境变量,保存
export PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:${PATH}"
alias python="/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"

# 令环境变量生效
source ~/.zshrc

 

标签:bin,python,Python,mac,PATH,3.10,os,环境变量
From: https://www.cnblogs.com/zhoulixue/p/16789477.html

相关文章