简体   繁体   中英

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.

Here is my .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. It says 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 ? 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).

Precision: The content of os.environ shows that it seems to read the .profile file only... But why ? My default terminal is zsh, not 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.

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:

EnvironmentFile=~/.zshenv

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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