vscode activating virtual environment in home directory from a subdirectory

Viewed 735

I'm connecting remotely to a server using ssh in vscode.

In my home directory, I have two "folders", py3 which a virtual environment and project1.

When I connect to the home directory, I can activate py3 without problems. But when I connect directly to the project1 folder, I'm not able to see the py3 in the list of virtual environments of vscode.

How can I activate it from a subfolder?

My question is not about the terminal, but how to do so from the vscode explorer.

1 Answers

You need to tell VS Code where to look for virtual environments that are not in your workspace (hence why it can detect py3). You can either directly specify the environment via the "python.pythonPath" setting or put your home directory in the "python.venvPath" setting. Check out the documentation on environments for the details of where the extension looks for environments.

Related