0

When I install VS Code extension for Python in Linux Mint it seems like it comes with a Python 3.10.6 interpreter. "Outside" VS Code I can't find that interpreter. When I start Python in terminal I use 3.8.10 and that interpreter can work with all my Python modules/libraries. In VS Code I can't access any of the extra modules.

I've tried to follow all suggested answers in "Invalid python interpreter selected" prompt vscode with no luck (clear interpreters settings, restart, downgrade Python extension). The only accepted interpreter is 3.10.6. I also tried to add the same path that is used in terminal by both writing it my self and manually cklicking me to the right location. VS Code still don't accept

I don't have this issue on Windows computers but on all Linux computers.

MarJer
  • 87
  • 2
  • 9

1 Answers1

0

To force VS Code to use a specific version of the Python interpreter, you can specify the interpreter path in the VS Code settings. Here's how you can do it:

  • Open VS Code and go to the "Settings" tab by clicking on the gear icon on the left-hand side of the window.

  • In the search bar at the top of the "Settings" tab, type "python.defaultInterpreterPath". This will show you the setting for the default Python interpreter path.

  • Click on the "Edit in settings.json" button to open the "settings.json" file.

  • In the "settings.json" file, add the following line to specify the path to the Python 3.8.10 interpreter:

    "python.defaultInterpreterPath": "/path/to/python3.8.10"

  • Replace "/path/to/python3.8.10" with the actual path to your Python 3.8.10 interpreter.

  • Save the "settings.json" file.

Restart VS Code for the changes to take effect.

MUHAMMED IQBAL PA
  • 3,152
  • 2
  • 15
  • 23
  • Thanks but I couldn't follow your descriptions due to that I don't have the "Edit in settings.json" button. I can, however, click on the gear just to the left of the headline "Python: Default Interpreter Path" and from there choose to "Copy setting as JSON". That gave me a line looking like this: "python.defaultInterpreterPath": "python" I also could change the value to "/usr/bin/python3", which seems to be my interpreter for 3.8.10. But that had no effect. After restarting VS Code it runs the 3.10.6 anyway. So I guess that I'm failing with editing the JSON, so where can I find that file? – MarJer Feb 14 '23 at 11:34