这篇文章主要介绍mac安装python3.5的方法,文中介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们一定要看完!

Python 3发布3.5版本,看了PEP新特性,还是非常棒。安装python3.5,并搭建相应的环境。

安装python3.5

官网网站下载python3.5的mac安装文件。安装3的同时,是不会影响2.X的,两个版本可以共存啦。

创建 virtulenv 环境

安装python3.5之后,3.x版本的包响应也在后面加个3,例如 pip和pip3

python3pythonpythonpython3python3.4mpython3.5m-configpython-configpython3-32python3.4m-configpythonwpython2.6python3-configpython3.5pythonw2.6python2.6-configpython3.4python3.5-32pythonw2.7python2.7python3.4-32python3.5-configpython2.7-configpython3.4-configpython3.5mpython3whichpython/usr/bin/pythonpython3whichpython3/usr/local/bin/python3python3whichpip/usr/local/bin/pippython3whichpip3/usr/local/bin/pip3

需要创建一个 虚拟环境,运行:

virtualenv-ppython3venv

该命令使用系统的python3来创建虚拟环境,激活venv环境,查看python版本

python3sourcevenv/bin/activate(venv)python3whichpython/Users/ghost/Rsj217/python3/venv/bin/python(venv)python3whichpython3/Users/ghost/Rsj217/python3/venv/bin/python3(venv)python3pythonPython3.5.0(v3.5.0:374f501f4567,Sep122015,11:00:19)[GCC4.2.1(AppleInc.build5666)(dot3)]ondarwinType"help","copyright","credits"or"license"formoreinformation.>>>

此时虚拟环境使用的就是python3.5啦。

以上是mac安装python3.5的方法的所有内容,感谢各位的阅读!希望分享的内容对大家有帮助,更多相关知识,欢迎关注亿速云行业资讯频道!