Sublime没有看到环境变量 [英] Sublime does not see env variables

查看:144
本文介绍了Sublime没有看到环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从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没有看到环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆