macOS升級Python3、PostgreSQL備忘錄

1. 升級PostgreSQL

最近PostgreSQL更新到了10,于是將原來的9.6進行升級。
brew upgrade postgresql

2. 升級Python3

電腦中的Python版本為3.6.1,于是也嘗試升級到最新的3.6.3。
brew upgrade python3

3. 在命令行中使用python3

升級Python后,原先的在命令行中使用Python3.6的命令python3失效,需要修改配置。

3.1. 打開.bash_profile文件

終端輸入:
open ~/.bash_profile

3.2. 編輯bash_profile文件內容

PATH="/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

#添加別名
Alias python3="/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/bin/python3.6"

3.3. 重新讀取.bash_profile文件

終端輸入:
source .bash_profile

4. 替換brew源

官方源下載速度實在太慢,可以替換成中科大或清華的鏡像:

4.1. 中科大鏡像

替換brew.git,終端輸入:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

替換homebrew-core.git,終端輸入:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

4.2. 清華鏡像:

cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

brew update

替換Homebrew-bottles:
open ~/.bash_profile
加入:

export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles

保存
source .bash_profile

4.3. 還原官方源:

重置brew.git:
cd "$(brew --repo)"
git remote set-url origin https://github.com/Homebrew/brew.git

重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://github.com/Homebrew/homebrew-core.git

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容

  • macOS軟件包管理器官網 安裝 卸載 常用命令 brew help 查看幫助brew install 安裝軟...
    chad_it閱讀 2,177評論 0 0
  • Spring Cloud為開發(fā)人員提供了快速構建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 134,923評論 18 139
  • cocoapods安裝過3次都蜜汁失敗 在第七次終于成功 下列附上過程 有耐心的朋友可以試試的我的步驟和方法 ps...
    _Dam0n閱讀 2,502評論 0 1
  • 轉載來之原作者Elsewhere** http://col.dog/2015/11/22/homebrew/ Ma...
    堅持編程_lyz閱讀 32,386評論 1 30
  • 一天,一只鳥兒飛落在井沿歇歇腳。一只坐在井里的青蛙與她攀談起來。 “你從哪里來呀?” “我從遙遠的地方來,我在天空...
    早安5點55閱讀 665評論 0 0