3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

PyenvとVNCの共存

Posted at

どうやらpyenvとvncサーバの組み合わせには難があるらしく、pyenvの環境変数を.bashrcに加えるとvncサーバを起動しても画面が真っ黒になって正常に表示できないらしい。

.bashrcには

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
export PATH="$PYENV_ROOT/versions/anaconda3-4.3.1/bin/:$PATH"

と記載する必要があるが、これがあるとvncserverが正常に起動しなくなる。
そこで、systemctlでvncserverを起動してからログイン後にこれら環境変数をexportする、というのが解決策らしいのだがちょっと面倒。

代替策として
.bash_profileに

User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
vncserver :1 -geometry 1280x1024 -depth 24

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

というふうにvncserverの起動を入れる。
その際、.bashrcを読み込む前にpathのexportとvncserverの起動を持ってくるようにする。
ただ、こうするとvncでアクセスする前にログインをしていなくてはならないので、vncクライアントで接続する前にsshで接続しておく必要がある。常時vncサーバを立てておくむきにはこれは問題となるが、今回pyenvを使うサーバはdeep learningの実験機であるため、使いたいときだけvncサーバを立てるので問題はない。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?