0
0

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 1 year has passed since last update.

LightsailのPythonをアップデート

Posted at

環境

VPS:AWS Lightsail
OS:Debian 11.5
git:2.30.2

pyenvをダウンロード

$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
# pyenvをclone

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
# 環境変数を定義

$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc
# pyenvの初期化処理を追記

$ exec "$SHELL"
# シェルの再起動

不足パッケージをインストール

下記は「Ubuntu/Debian/Mint」の例ですが
その他のOSの場合は下記から確認できます。
https://github.com/pyenv/pyenv/wiki

$ sudo apt update; sudo apt install build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Pythonのインストール

任意のバージョンをインストールしてglobalに設定します。(今回は3.11.1)

$ pyenv install 3.11.1
・・・
$ pyenv global 3.11.1
$ python -V
> Python 3.11.1
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?