I'm trying to add the src folder to my PYTHONPATH
i.E. do the same thing as Mark directory as sources root
in PyCharm.
I've looked at the solutions to Visual Studio Code - How to add multiple paths to python path? but the solutions shown there do not work for me.
I've set up my minimal example as follows shown in the screenshot below:
My understanding would be that having a .env file with PYTHONPATH="./src;${PYTHONPATH}"
would add the src file to the path.
Nevertheless, when running the code runner or when running python change_pyhton_path.py
src is not part of the PYTHONPATH and the direct import from src fails.
I do have setting "python.envFile": "${workspaceFolder}/.env"
.
In pyCharm on the other hand everything works as it should after hitting Mark directory as source
on src.
Thanks for helping out!
To do so, press CMD + SHIFT + P , type Python, and choose Select Interpreter.
in your settings.json
add:
"terminal.integrated.env.windows": {
"PYTHONPATH": "full python path here"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With