0

as you see "python --version show python3.10.4

but the interpreter show python 3.7.3

enter image description here

how can i change the envirnment in vscode

NicoCaldo
  • 1,171
  • 13
  • 25
KKC
  • 1
  • 1
  • 1
    Does this answer your question? [How can I change the Python version in Visual Studio Code?](https://stackoverflow.com/questions/48135624/how-can-i-change-the-python-version-in-visual-studio-code) – Andreas Violaris May 30 '22 at 10:13
  • related (duplicates?): https://stackoverflow.com/q/60836646/11107541 https://stackoverflow.com/q/66670568/11107541 – starball May 19 '23 at 06:42

3 Answers3

0

If you click on the interpreter version being used by VSCode, you should be able to select different versions across your device.

Interpreter version

Magehawk
  • 134
  • 1
  • 7
  • i have been try this before , still can not change envirroment to python 3.7 . because i want to run streamlit in vscode . – KKC May 30 '22 at 10:21
  • Anaconda Navigator open terminal can succeed to change the environments in terminal , but vscode can not . – KKC May 30 '22 at 10:23
  • @KKC Perhaps you could try to run it in a virtual environment. – Magehawk May 30 '22 at 10:24
  • @KKC Also since the interpreter version seems to be the desired one (3.7), you could just create an alias in your terminal to address the interpreter version, unless you want to run it on 3.10. – Magehawk May 30 '22 at 10:30
  • thanks a lot , how can it creata alias in your terminal to address the interpreter version, – KKC May 30 '22 at 11:09
  • @KKC Apparently aliases don't work in subshells, so you need to use functions. This answer might help you: https://stackoverflow.com/a/58417030/18468350 – Magehawk May 30 '22 at 11:21
  • But you can always revert to virtual envs which helps you to select isolated versions for each project. – Magehawk May 30 '22 at 11:28
0

Selecting the interpreter in VSCode:

https://code.visualstudio.com/docs/python/environments#_work-with-python-interpreters

To run streamlit in vscode: Open the launch.json file of your project. Copy the following:

{
    "configurations": [
        

        {
            "name": "Python:Streamlit",
            "type": "python",
            "request": "launch",
            "module": "streamlit",
            
            "args": [
                
                "run",
                "${file}"
            ]
        }
     ]
}

YScharf
  • 1,638
  • 15
  • 20
0

Adding the following line to your setting.json (crtl+shift+P "preferences: open settings(JSON)").

"terminal.integrated.env.osx": {
    "PATH": ""
}
MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13