Python 3發(fā)布3.5版本,看了PEP新特性,還是非常棒晴埂。安裝python3.5诞吱,并搭建響應的環(huán)境。
安裝python3.5
官網(wǎng)網(wǎng)站下載python3.5的mac安裝文件暴匠。安裝3的同時鞍恢,是不會影響2.X的,兩個版本可以共存啦。
創(chuàng)建 virtulenv 環(huán)境
安裝python3.5之后帮掉,3.x版本的包響應也在后面加個3弦悉,例如 pip和pip3
?? python3? python
python ? ? ? ? ? python3? ? ? ? ? ? python3.4m? ? ? ? python3.5m-config
python-config? ? ? python3-32 ?python3.4m-config? pythons
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
需要創(chuàng)建一個 虛擬環(huán)境,運行:
virtualenv -p python3 venv
該命令使用系統(tǒng)的python3來創(chuàng)建虛擬環(huán)境蟆炊,激活venv環(huán)境稽莉,查看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? pythonPython3.5.0(v3.5.0:374f501f4567, Sep122015,11:00:19)[GCC4.2.1(Apple Inc. build5666) (dot3)]?
on darwin ? ?Type"help","copyright","credits"or"license"formore information.
>>>
此時虛擬環(huán)境使用的就是python3.5啦
安裝ipython適合3.5的版本
激活venv虛擬環(huán)境,使用 pip3直接安裝 ipython
(venv)?? python3? pip3installipython...
(venv)?? python3? which ipython/Users/ghost/Rsj217/python3/venv/bin/ipython
(venv)?? python3? ipythonPython3.5.0
(v3.5.0:374f501f4567, Sep122015,11:00:19)Type "copyright", "credits" or ?"license" for more information.
IPython4.0.0-- An enhanced Interactive Python.
?? ? ? ? -> IntroductionandoverviewofIPython's features.
%quickref -> Quick reference.
help? ? ? -> Python's ownhelpsystem.
object?? -> Details about'object' ,use 'object??' for ?extra details.
In[1]:
原文鏈接:http://www.reibang.com/p/002c425041fb