简体   繁体   English

Emacs的组织模式:为了能够在Emacs守护程序中使用它,我必须将导出放在哪里?

[英]Org-mode with Emacs: Where do I have to put my export in order to be able to use it in Emacs daemon?

I am struggling since this morning after the installation of CUDA 9 and cudnn 7. I am running emacs as a daemon, zsh as my default shell and I want to user org-mode to write notebook. 自从今天早上安装CUDA 9和cudnn 7之后,我一直在挣扎。我将emacs作为守护程序运行,将zsh作为默认外壳程序运行,并且我希望使用用户组织模式来编写笔记本。

Here is my .zshenv: 这是我的.zshenv:

...
export LIBRARY_PATH="/usr/include/gtk-3.0:$LIBRARY_PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-9.0/lib64:$LD_LIBRARY_FOUND"
export PATH="/usr/local/cuda-9.0/bin:$PATH"
export SHELL="/bin/zsh"
export WORKON_HOME=$HOME/.virtualenvs

and here is the minimal notebook: 这是最小的笔记本:

#+BEGIN_SRC ipython :results drawer :async t :session test
  import os

  print(os.environ["LD_LIBRARY_PATH"])
#+END_SRC

The problem is that emacs does not know LD_LIBRARY_PATH. 问题是emacs不知道LD_LIBRARY_PATH。 It says KeyError. 它说KeyError。

Do you know where I can put my environment variables in order to be able to be read both by my terminal and Emacs-As-A-Daemon ? 您知道我可以在哪里放置环境变量,以便可以同时被终端和Emacs-As-A-Daemon读取吗? I thought it was in .zshenv and .zprofile but neither of them is working in daemon mode... (Because yes, it is working when I launch it regularly). 我以为它在.zshenv和.zprofile中,但是它们都不在守护程序模式下工作(因为是的,当我定期启动它时,它就可以工作)。

Precision: The content of os.environ shows that it seems to read the .profile file only... But why ? 精度:os.environ的内容表明它似乎只读取.profile文件...但是为什么呢? My default terminal is zsh, not bash. 我的默认终端是zsh,而不是bash。 I tried to put my export in .zprofile, restart systemd daemon of emacs, even rebooting, but without any effect.. Sorry if this is a silly question. 我试图将导出文件放在.zprofile中,重新启动emacs的systemd守护程序,甚至重新启动,但没有任何效果。.很抱歉,这是一个愚蠢的问题。

Alright, I succeed to solve my issue. 好吧,我成功解决了我的问题。 Instead of dealing with Emacs configuration, I changed the systemd unit file with the addition of the EnvironmentFile variable which I set it equal to the path of my .zshenv: 我没有处理Emacs配置,而是通过添加EnvironmentFile变量更改了systemd单元文件,该变量将其设置为等于.zshenv的路径:

EnvironmentFile=~/.zshenv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM