Sublime does not see env variables

依然范特西╮ 提交于 2019-12-25 05:32:10

问题


When running sublime from desctop it does not see my PERL5LIB environment variable. When running it from terminal - everithing is OK. I set my variables in .bashrc and .bash_profile.

import os
>>> os.environ['SHELL']
'/bin/bash'
>>> os.environ['PERL5LIB']
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "./os.py", line 676, in __getitem__
KeyError: 'PERL5LIB'

this makes trouble with linting and build system - I can not link and build becase of perl does not see libraries.

How to fix env variable?


回答1:


Bad news:

The Ubuntu desktop session is no longer affected by .profile. Additionally bash doesn't parse .profile if either .bash_profile or .bash_login exists.

You can work around:

Launching desktop application with an environment variable

You can add an environment variable to an application by editing its .desktop file. For example, to run "digiKam" with the environment variable APPMENU_DISPLAY_BOTH=1, find the corresponding digikam.desktop file and add the setting of the variable, via the env command, to the entry "Exec":

Exec=env APPMENU_DISPLAY_BOTH=1 digikam -caption "%c" %i

or do small script:

#!/bin/bash
source ~/.bashrc
/opt/sublime_text/sublime_text


来源:https://stackoverflow.com/questions/28940230/sublime-does-not-see-env-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!