設定要使用的python版本
{
"jupyter.alwaysTrustNotebooks": true,
"python.pythonPath": "/Users/hanklee/.pyenv/versions/3.8.0/bin/python",
"terminal.integrated.env.osx": {
"PATH": ""
}
}
- 這邊要注意的只有裡面的兩行一定要有:
-
"python.pythonPath": "/Users/hanklee/....", 這邊的路徑,就是放你想要跑的版本。例如我都用pyenv來管理我的python version,那我可以在terminal用pyenv global 3.8.0來選定我要用3.8.0的版本後,再下which python,來得到這個版本的路徑。做完這行設定後,只要在VScode中點視窗右上角的run,他就會幫你下達這個指令:path/to/python/version path/to/this/file。
-
"PATH": "",這個指令,是我google到的解法(連結),主要是要解決,在VScode中,我開視窗下面的terminal,但執行python時,還是沒有執行到python.pythonPath的版本。