Search code examples
pythondocker-composevscode-extensionswindows-subsystem-for-linuxvscode-devcontainer

Unable to recognise python interpreter path in vscode devcontainer


In wsl, python is not recognised in vscode's devcontainer interpreter settings.

  • /usr/bin/python3 (path displayed in which python3) enter image description here enter image description here

The following were executed in order, but the paths were not recognised

  • sudo apt install python-is-python3
  • Restarting wsl

Solution

  • The reason was that another container was specified for the service in devcontainer.json. After the fix. The interpreter is now the default and the interpreter path for the flask api container is automatically set. Incidentally, you have specified "python.defaultInterpreterPath":"/usr/bin/python" in devcontainer.json, but this setting does not seem to be seen. This issue has been resolved and we are done.