LoginSignup
6
6

More than 3 years have passed since last update.

さくらのレンタルサーバーにpyenvを構築する方法

Last updated at Posted at 2019-09-29

なんか間違ってたり、難しい方法でやってるの多かったから。あと、自分のブログで書くほどのことでもないから。

bashに変更

$ chsh -s /usr/local/bin/bash
$ cat << EOS > ~/.bash_profile
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi
PATH=$PATH:$HOME/bin:$HOME/usr/local/bin
EOS

$ exec $SHELL -l

pyenvをインストール

$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
$ cat << EOS >> ~/.bash_profile
export PATH
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export TMPDIR=/home/nashio/tmp
eval "$(pyenv init -)"
pyenv rehash
EOS
$ source ~/.bash_profile

pyenv を使って好きなバージョンをインストール

$ pyenv install --list
$ pyenv install 3.7.4
$ pyenv global 3.7.4
$ which python
/home/ユーザー名/.pyenv/shims/python
6
6
1

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
6
6