从desctop运行sublime时,看不到我的PERL5LIB环境变量. 从终端运行时,一切正常. 我在.bashrc和.bash_profile中设置了变量.
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'这会给棉绒和构建系统带来麻烦-我无法链接和构建,因为perl看不到库.
this makes trouble with linting and build system - I can not link and build becase of perl does not see libraries.
如何修复环境变量?
推荐答案坏消息:
Ubuntu桌面会话不再受.profile的影响. 此外,如果.bash_profile或 .bash_login存在.
The Ubuntu desktop session is no longer affected by .profile. Additionally bash doesn't parse .profile if either .bash_profile or .bash_login exists.
您可以解决:
使用环境变量启动桌面应用程序
您可以通过编辑环境变量将其添加到应用程序中 .desktop文件.例如,在环境中运行"digiKam" 变量APPMENU_DISPLAY_BOTH = 1,找到对应的 digikam.desktop文件,并通过env添加变量的设置 命令,进入条目"Exec":
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
或执行小脚本:
#!/bin/bash source ~/.bashrc /opt/sublime_text/sublime_text更多推荐
Sublime没有看到环境变量
发布评论