{"id":15132837,"url":"https://github.com/led-mirage/raspi4-pyenvguide","last_synced_at":"2026-01-19T05:32:47.432Z","repository":{"id":189925382,"uuid":"681061848","full_name":"led-mirage/Raspi4-PyenvGuide","owner":"led-mirage","description":"Installation Guide for pyenv on Raspberry Pi 4","archived":false,"fork":false,"pushed_at":"2023-08-22T00:46:21.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-05T21:45:02.551Z","etag":null,"topics":["guide","pyenv","raspberry-pi","raspberry-pi-4"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/led-mirage.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-08-21T07:17:41.000Z","updated_at":"2023-08-22T09:37:27.000Z","dependencies_parsed_at":"2023-08-22T13:08:37.027Z","dependency_job_id":null,"html_url":"https://github.com/led-mirage/Raspi4-PyenvGuide","commit_stats":null,"previous_names":["led-mirage/raspi4-pyenvguide"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/led-mirage%2FRaspi4-PyenvGuide","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/led-mirage%2FRaspi4-PyenvGuide/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/led-mirage%2FRaspi4-PyenvGuide/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/led-mirage%2FRaspi4-PyenvGuide/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/led-mirage","download_url":"https://codeload.github.com/led-mirage/Raspi4-PyenvGuide/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247406070,"owners_count":20933802,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["guide","pyenv","raspberry-pi","raspberry-pi-4"],"created_at":"2024-09-26T04:40:41.525Z","updated_at":"2026-01-19T05:32:47.402Z","avatar_url":"https://github.com/led-mirage.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Raspberry Pi 4 への pyenv の導入方法\n\nCreated on August 21, 2023  \nUpdated on August 22, 2023    \nCopyright (c) 2023 led-mirage\n\n## はじめに\n\nこの資料では Raspberry Pi 4 に Python のバージョン管理ツール pyenv を導入する手順について説明します。\n\n公式には[GitHub](https://github.com/pyenv/pyenv#automatic-installer)に導入手順が載っていますので、最新・正確な手順を確認したい場合はそちらを参照してください。Debianの手順でやればOKです。\n\n検証に使用した環境は以下の通りです。\n\n- Raspberry Pi 4 Model B 4GB\n- Raspberry Pi OS 64bit Bullseye\n- pyenv 2.3.24\n\n## １．依存するモジュールのインストール\n\nまず最初に pyenv が依存するモジュールをインストールします。  \n次のコマンドを実行してください。  \n[ここ](https://github.com/pyenv/pyenv/wiki#suggested-build-environment)を見ると何をインストールすればいいかわかります。\n\n```bash\nsudo apt update\nsudo apt install build-essential libssl-dev zlib1g-dev \\\nlibbz2-dev libreadline-dev libsqlite3-dev curl \\\nlibncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev\n```\n\n## ２．pyenvを自動インストール\n\n次のコマンドで pyenv をインストールします。\n\n```bash\ncurl https://pyenv.run | bash\n```\n\n## ３．パスの設定\n\n以下のコマンドで、`~/.bashrc` に行を追加します。\n\n```bash\necho 'export PYENV_ROOT=\"$HOME/.pyenv\"' \u003e\u003e ~/.bashrc\necho 'command -v pyenv \u003e/dev/null || export PATH=\"$PYENV_ROOT/bin:$PATH\"' \u003e\u003e ~/.bashrc\necho 'eval \"$(pyenv init -)\"' \u003e\u003e ~/.bashrc\n```\n\n以下のファイル（`~/.profile`、`~/.bash_profile`、`~/.bash_login`）がある場合は、それらにも同じように追加します。導入直後のラズパイの場合、`~/.profile` のみ存在しました。\n\n`~/.profile` に追加する例\n\n```bash\necho 'export PYENV_ROOT=\"$HOME/.pyenv\"' \u003e\u003e ~/.profile\necho 'command -v pyenv \u003e/dev/null || export PATH=\"$PYENV_ROOT/bin:$PATH\"' \u003e\u003e ~/.profile\necho 'eval \"$(pyenv init -)\"' \u003e\u003e ~/.profile\n```\n\n## ４．シェルの再起動\n\nシェルを再起動してパスの変更を有効化します。\n\n```bash\nexec \"$SHELL\"\n```\n\n## ５．pyenv のバージョンの確認\n\n以上で pyenv はインストールされたはずなので、次のコマンドでバージョンを確認してみましょう。\n\n```bash\npyenv --version\n```\n\n## ６．Python のインストール\n\n次のコマンドで指定したバージョンの Python をインストールできます。\n\n```bash\npyenv install 3.11.4\n```\n\nインストールが可能な Python のバージョンは次のコマンドで調べることができます。\n\n```bash\npyenv install -list\n```\n\n## ７．使用する Python のバージョンの選択\n\n次のコマンドで使用する Python のバージョンを選択できます。\n\n```bash\npyenv global 3.11.4\n```\n\n## ８．その他のコマンド\n\n### 指定したバージョンの Python のアンインストール\n\n```bash\npyenv uninstall 3.11.4\n```\n### pyenv の更新\n\n```bash\npyenv update\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fled-mirage%2Fraspi4-pyenvguide","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fled-mirage%2Fraspi4-pyenvguide","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fled-mirage%2Fraspi4-pyenvguide/lists"}