Mac上,python多版本共存(非切换)

by Liu Yue/2017-04-08

最近需求是要抓取线上视频,要用到you-get,一看wiki,干,要用到3.0,一直是2.7的忠实拥趸,又不想来回切换版本太麻烦,能不能共存呢?答案当然是可以啦,命令如下,以后想用3.0,直接在命令行下打/python3就可以啦,美滋滋



# wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz

# mkdir /usr/local/python3 

# tar -zxvf Python-3.7.3.tgz

# cd Python-3.7.3

# ./configure --prefix=/usr/local/python3

# sudo make install

# ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3  (/usr/local/bin/python3)

# ln -s /opt/local/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 

# /usr/bin/python3