Set global $PATH environment variable in VS Code

后端 未结 8 1863
温柔的废话
温柔的废话 2020-12-14 02:28

I\'m defining a custom $PATH environment variable in my ~/.bash_profile (on a Mac), like so:

PATH=\"$HOME/.cargo/bin:$PATH:$HOME/bi         


        
相关标签:
8条回答
  • 2020-12-14 03:09

    Visual Studio Code is the problem.

    No matter how you set your PATH variable in the shell, there are cases where Visual Studio Code will not inherit your PATH setting. If you're using an application launcher like LaunchBar to start Visual Studio Code, your PATH variable will not be inherited.

    Here is a system-wide fix:

    In the /etc/paths.d directory, create a file with your Unix username. In that file, place the additional paths that Visual Studio Code needs to work. In my case, this is the contents of my /etc/paths.d file:

    /usr/ucb /opt/local/bin /opt/local/sbin ~/go/bin

    Note: Your /etc/paths.d file will be processed system-wide. Since most systems are single-user, this shouldn't be a problem for most developers.

    0 讨论(0)
  • 2020-12-14 03:09

    I'm working with ubuntu 18.04. I had a similar problem, my enviroment variables were defined and the terminal knows the $PATH but when I tried to debug with golang, go libraries were not found in $PATH variable.

    So, to solve it I uninstall the default version from ubuntu software and install manually using the following instructions:

    https://code.visualstudio.com/docs/setup/linux

    It works for me.

    0 讨论(0)
提交回复
热议问题