slow-starter

なにをやるにもslow start……。

python_027 pyenv virtualenv(1)

環境構築

  • 仮想環境を利用して構築すると良いらしい。

pyenv 設定

  • 複数バージョンのpython実行環境を利用可能になる。
$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo '### pyenv settings'                  >> ~/.bashrc
$ echo 'export PYENV_ROOT="$HOME/.pyenv"'    >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(pyenv init -)"'              >> ~/.bashrc

pyenv 利用

## インストール済みバージョン一覧表示
$ pyenv versions

## 利用可能なバージョン一覧表示
$ pyenv install -l

## 特定バージョン(N.N.N)インストール
$ pyenv install   N.N.N

## 特定バージョン(N.N.N)を利用する
$ pyenv global N.N.N         # 全体設定として特定バージョンを利用
$ rm ~/.pyenv/version        # 解除

$ pyenv local  N.N.N         # 特定ディレクトリで特定バージョンを利用
$ pyenv local --unset        # 解除

$ pyenv shell  N.N.N         # シェル内で特定バージョンを利用
$ pyenv shell --unset        # 解除

## 特定バージョン(N.N.N)のアンインストール
$ pyenv uninstall N.N.N

pyenv help情報

$ pyenv help
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   --version   Display the version of pyenv
   activate    Activate virtual environment
   commands    List all available pyenv commands
   deactivate   Deactivate virtual environment
   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-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

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme

参考情報