人工智能-AIPython思科DevNet

Mac OS 安装 Python3.5

2015-09-20  本文已影响18372人  人世间

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

安装python3.5

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

创建 virtulenv 环境

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

☁  python3  python
python             python3            python3.4m         python3.5m-config
python-config      python3-32         python3.4m-config  pythonw
python2.6          python3-config     python3.5          pythonw2.6
python2.6-config   python3.4          python3.5-32       pythonw2.7
python2.7          python3.4-32       python3.5-config
python2.7-config   python3.4-config   python3.5m
☁  python3  which python
/usr/bin/python
☁  python3  which python3
/usr/local/bin/python3
☁  python3  which pip
/usr/local/bin/pip
☁  python3  which pip3
/usr/local/bin/pip3

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

virtualenv -p python3 venv

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

☁  python3  source venv/bin/activate
(venv)☁  python3  which python
/Users/ghost/Rsj217/python3/venv/bin/python
(venv)☁  python3  which python3
/Users/ghost/Rsj217/python3/venv/bin/python3
(venv)☁  python3  python
Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

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

安装ipython适合3.5的版本

激活venv虚拟环境,使用 pip3直接安装 ipython

(venv)☁  python3  pip3 install ipython

...
(venv)☁  python3  which ipython
/Users/ghost/Rsj217/python3/venv/bin/ipython
(venv)☁  python3  ipython
Python 3.5.0 (v3.5.0:374f501f4567, Sep 12 2015, 11:00:19)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:

That's all, enjoy~

上一篇下一篇

猜你喜欢

热点阅读