最終更新:2024-01-23 (火) 08:39:58 (93d)
pyenv
Top / pyenv
Simple Python version management
https://github.com/pyenv/pyenv
Windows
インストール
依存パッケージ
インストーラ
- pyenv-installer
- https://github.com/pyenv/pyenv-installer
- 下記のpyenvのパッケージをインストールするだけなので依存ライブラリは別に入れておく必要がある
インストール対象
- pyenv
- pyenv-doctor
- pyenv-installer
- pyenv-update?
- pyenv-virtualenv
- pyenv-which-ext?
コマンド
- pyenv install: Install a Python version using python-build
- pyenv install --list - List all available versions
- pyenv update
- pyenv version?: Show the current Python version(s) and its origin
- pyenv versions: List all Python versions available to pyenv
- pyenv doctor: Verify pyenv installation and development tools to build pythons.
- pyenv init?: Verify pyenv installation and development tools to build pythons.
- pyenv uninstall?
切り替え
pyenv local
- 現在のディレクトリ以下にのみ適用したい場合
pyenv global
- 全ディレクトリで適用したい場合
help
Usage: pyenv <command> [<args>] Some useful pyenv commands are: activate Activate virtual environment commands List all available pyenv commands deactivate Deactivate virtual environment doctor Verify pyenv installation and development tools to build pythons. exec Run an executable with the selected Python version global Set or show the global Python version(s) help Display help for a command hooks List hook scripts for a given pyenv command init Configure the shell environment for pyenv install Install a Python version using python-build local Set or show the local application-specific Python version(s) prefix Display prefix for a Python version rehash Rehash pyenv shims (run this after installing executables) root Display the root directory where versions and shims are kept shell Set or show the shell-specific Python version shims List existing pyenv shims uninstall Uninstall a specific Python version version Show the current Python version(s) and its origin --version Display the version of pyenv version-file Detect the file that sets the current pyenv version version-name Show the current Python version version-origin Explain how the current Python version is set versions List all Python versions available to pyenv virtualenv Create a Python virtualenv using the pyenv-virtualenv plugin virtualenv-delete Uninstall a specific Python virtualenv virtualenv-init Configure the shell environment for pyenv-virtualenv virtualenv-prefix Display real_prefix for a Python virtualenv version virtualenvs List all Python virtualenvs found in `$PYENV_ROOT/versions/*'. whence List all Python versions that contain the given executable which Display the full path to an executable
旧
Python/ビルド
環境変数
コマンド
# the sed invocation inserts the lines at the start of the file # after any initial comment lines sed -Ei -e '/^([^#]|$)/ {a \ export PYENV_ROOT="$HOME/.pyenv" a \ export PATH="$PYENV_ROOT/bin:$PATH" a \ ' -e ':a' -e '$!{n;ba};}' ~/.profile echo 'eval "$(pyenv init --path)"' >>~/.profile echo 'eval "$(pyenv init -)"' >> ~/.bashrc
- .profile
export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" echo 'eval "$(pyenv init --path)"'
- .bashrc
echo 'eval "$(pyenv init -)"'
Ubuntuの場合のメモ
.bashrc
export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)"