環(huán)境安裝
-
macOS 上安裝 python
-
自動(dòng)安裝方式一 -- homebrew
brew install python # 然后安裝提示,中心配置環(huán)境變量,將 python 添加到 PATH
-
-
自動(dòng)安裝二 (使用
pyenv,此方法可以在以后方便安裝其他版本的python)brew install pyenv # 安裝 python 版本管理工具(類似于nvm、rvm、jenv) pyenv install 3.8-dev # 安裝 python 3.8 pyenv global 3.8-dev # 配置默認(rèn) python 版本 pyenv init # 執(zhí)行 init 命令,按照提示加載 pyenv 到 shell # 如果使用的是bash,請(qǐng)將代碼添加到 ~/.profile export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" # 在 ~/.bashrc 中加載pyenv eval "$(pyenv init -)" # 如果是zsh,請(qǐng)將代碼添加到 ~/.profile 和 ~/.zprofile 文件 export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init --path)" # 在 ~/.zshrc 文件中加載pyenv eval "$(pyenv init -)" -
手動(dòng)安裝
打開(kāi) python 官網(wǎng),點(diǎn)擊下載鏈接 https://www.python.org/downloads/,找到下載按鈕,下載安裝包安裝即可。
-
Windows
-
scoop自動(dòng)安裝
scoop install python # 就這么簡(jiǎn)單
-
-
手動(dòng)安裝
打開(kāi) python 官網(wǎng),點(diǎn)擊下載鏈接 https://www.python.org/downloads/,找到下載按鈕,下載安裝包安裝即可。
IDE
-
-
macOS
點(diǎn)擊下載鏈接,然后選擇自己的系統(tǒng)版本下載安裝,解壓后拖進(jìn)
Applicaitons文件夾即可-
使用 homebrew 安裝
brew install --cask visual-studio-code
-
Windows
點(diǎn)擊下載鏈接,然后選擇自己的系統(tǒng)版本下載安裝
-
vscode 配置
-
新建一個(gè)文件,編輯器點(diǎn)擊最后下角
plain textScreen Shot 2021-09-07 at 8.58.11 PM.png 在彈出窗口中,輸入
python然后回車
Screen Shot 2021-09-07 at 8.58.22 PM.png- 彈出窗口中選擇
Install, 這會(huì)安裝python插件
Screen Shot 2021-09-07 at 8.58.27 PM.png -
-
-
安裝
python插件中Screen Shot 2021-09-07 at 8.58.38 PM.png
- 插件安裝完成后,會(huì)有如下提示,如果沒(méi)有安裝過(guò)
python, 選擇第一個(gè)點(diǎn)擊 button 繼續(xù)

-
如果自己已經(jīng)安裝過(guò)
python, 選擇第二個(gè)來(lái)配置python解析器Screen Shot 2021-09-07 at 8.59.36 PM.png
-
然后選擇你安裝的
python路徑,如果有多個(gè)請(qǐng)選擇python3最新版本Screen Shot 2021-09-07 at 8.59.42 PM.png
-
測(cè)試是否安裝成功,在文件中輸入
print("hello world!")Screen Shot 2021-09-07 at 9.00.24 PM.png
-
文件中鼠標(biāo)右鍵,然后選擇
Run Selection/Line in Python TerminalScreen Shot 2021-09-07 at 9.00.35 PM.png
- 出現(xiàn)以下類似界面,即為安裝成功

-
點(diǎn)擊下載連接下載安裝,注意選擇社區(qū)版本
-
安裝成功后,打開(kāi) PyCharm, 選擇
New ProjectScreen Shot 2021-09-07 at 9.15.42 PM.png
-
- 選擇第一個(gè)
Pure Python, 然后配置你的python解析器, 紅框位置二選一即可
Screen Shot 2021-09-07 at 9.16.02 PM.png









