Python之父Guido van Rossum在邮件列表上宣布 Python 2.7将于2020年1月1日终止支持。用户如果想要在这个日期之后继续得到与Python 2.7有关的支持,则需要付费给商业供应商。
12
**Guido van Rossum 表示:**Let's not play games with semantics.**The way I see the situation for 2.7 is that EOL is January 1st, 2020, and there will be no updates, not even source-only security patches, after that date.(Python 2.7提供的支持截止到2020年1月1日,并且在那之后将不会有更新,甚至没有源代码安全补丁。)**Support (from the core devs, the PSF, and python.org) stops completely on that date. If you want support for 2.7 beyond that day you will have to pay a commercial vendor. Of course it's open source so people are also welcome to fork it. But the core devs have toiled long enough, and the 2020 EOL date (an extension from the originally annouced 2015 EOL!) was announced with sufficient lead time and fanfare that I don't feel bad about stopping to support it at all.
1、查看 mac 自带系统版本#查看系统自带的pythonopen /System/Library/Frameworks/Python.framework/Versions#系统当前的python版本。python -V2、开始安装(这里我们使用神器homebrew)#安装前先搜索一下是否已经存在python3的包:brew search python3#已经存在,我们可以直接安装了:brew install python3#出现如下报错 Error: An unexpected error occurred during the `brew link` stepThe formula built, but is not symlinked into /usr/localPermission denied @ dir_s_mkdir - /usr/local/FrameworksError: Permission denied @ dir_s_mkdir - /usr/local/Frameworks#手动创建一个这个目录sudo mkdir /usr/local/Frameworks#再来解决权限问题:sudo chown $(whoami):admin /usr/local/Frameworks#手动执行一下安装时未完成的创建连接:brew link python3#当前系统下的python3的信息:brew info python3#系统当前的python版本。python -V
2.修改mac当前系统的默认版本为Python3.*版本
12345678910111213
#查找python3安装路径brew info python3#修改 Mac 系统配置文件vi ~/.bash_profile#添加配置信息# Setting PATH for Python 3.7 # Python3的环境变量# The original version is saved in .bash_profile.pysavePATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"export PATH#编译系统配置文件source ~/.bash_profile#系统当前的python版本。python -V
- 下面是我的.bash_profile配置文件(避免有的伙伴看不懂,加了中文注释哦!)
- 虚拟环境、数据库的配置可以不用配置(不写上即可,没有安装写上会出错)
1234567891011121314151617
# Setting PATH for Python 3.7 # Python3的环境变量# The original version is saved in .bash_profile.pysavePATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"export PATH# ———————————下面的虚拟环境、数据库的配置可以不用配置(不写上即可,没有安装写上会出错)—————————————————# Setting virtualenv PATH for Python 3.7 # 虚拟环境的配置export WORKON_HOME='~/workspace'export VIRTUALENVWRAPPER_SCRIPT=/Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvwrapper.shexport VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.7/bin/python3export VIRTUALENVWRAPPER_VIRTUALENV=/Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvexport VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'source /Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvwrapper.sh# setting MySQL PATH # MySQL数据库的环境变量配置PATH=/usr/local/mysql/bin:$PATHexport PATH