How to configure python environs for Visual Studio Code

If you need to store environment variables for Python that does not automatically get detected by VS Code then this answer should hopefully help you.

I am doing a Data Science bootcamp and need to store a specific path for one of my challenges.

Exporting PYTHONPATH in ~/.zshrc works perfectly when I run the notebook directly from Juypter, however the environment variable is not detected through VS Code.

I created a global file in my home directory from the pwd (present working directory) that I wanted to store in my path:

echo "export PYTHONPATH=$(pwd):$PYTHONPATH" >> ~/.python-env

Enter fullscreen mode Exit fullscreen mode

I opened the JSON User Settings in VS Code and added the python.envFile setting which points directly to ~/.python-env

{ "python.envFile": "~/.python-env" } 

Enter fullscreen mode Exit fullscreen mode

原文链接:How to configure python environs for Visual Studio Code

© 版权声明
THE END
喜欢就支持一下吧
点赞6 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容