安裝python
安裝homebrew(補充一下!http://www.itdecent.cn/p/b1de316fc3fc)
終端輸入brew install python3
進入python
appledeMacBook:~ JEZAU$ python3
mac上直接輸入python默認進入2.7
查找路徑:
直接在終端輸入
python -c "import sys; print sys.executable"
which??python
打開python后輸入
import sys
sys.executable
或import sys
print sys.path
或
import sys
print(sys.path)
修改默認路徑(沒成功
print(sys.path)
/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6
alias python=“剛查到的你電腦中的路徑/..”
一定要到文件 不可以是一個目錄 否則提示:
-bash: /usr/local/Cellar/python3/3.6.1: is a directory
import sysappledeMacBook:~ JEZAU$ alias python="/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6"
重啟終端
退出python
ctrl+z
exit()
直接在mac終端換行 \+空格