Dylan Coffel
Dylan Coffel

Reputation: 1

Don't understand how to point my python project file to my venv directory

I've set up a venv named env with the packages that I need.

I am using vscode as my editor but don't know how to tell the file I'm working on to use the venv directory, resulting in packages not importing at all. Please help.

(env) Dylans-MacBook-Pro:~ dylan$ ls
=1.13           Documents       Movies          Public
Applications    Downloads       Music           env
Desktop         Library         Pictures

Upvotes: 0

Views: 62

Answers (1)

Nickolay
Nickolay

Reputation: 32063

As documented in Using Python environments in VS Code, to make VS Code use the correct interpreter, you should invoke the Python: Select Interpreter command from the Command Palette (it's also available by clicking on the currently selected interpreter in the status bar).

You should create the virtual env in the project directory or in ~/.virtualenvs (via virtualenvwrapper) for it to be picked up by VSCode.

As others noted, to use the environment on the command line, you have to activate it, for example on macOS:

source path_to_env/bin/activate

Upvotes: 2

Related Questions