■何?
いろんなバージョンのPython環境を管理するためのもの。いろんなPython環境を切り替えることで、いろんなPythonパッケージをいれまくってぐっちゃぐちゃにしてもいいし、OSデフォルトのPythonを汚さなくて済む。
いまとなってはdirenvが隆盛していて、その控えくらいになりつつある?のかな?
■インストール
いろんなとこ見てもだいたいgitとかbrewからなのだけど、手動でもいける。
1)
https://github.com/yyuu/pyenv
ここの「Download ZIP」でダウンロードしてくる
2)
適当なところに置く
3)
上記URLのInstallationにあるコマンド
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
の、$HOME/.pyenv の部分を、さきほど置いたpyenvのパスに置き換えて実行。たとえば「書類」のなかに「pyenv」というフォルダ名で置いたなら
$ echo 'export PYENV_ROOT="$HOME/Documents/pyenv"' >> ~/.bash_profile
とでもしておくこれで、ユーザフォルダ直下に、.bash_profileという不可視ファイルに設定が書き込まれます。(同ファイルは、無ければ作成されます)
4)
あとは上記URLの手順通り作業を進めます。
シェルを再起動したら、
$ pyenv -h
とかやって確かめてみる。
$ pyenv -h
pyenv 20151006
Usage: pyenv <command> [<args>]
Some useful pyenv commands are:
commands List all available pyenv commands
local Set or show the local application-specific Python version
global Set or show the global Python version
shell Set or show the shell-specific Python version
install Install a Python version using python-build
uninstall Uninstall a specific Python version
rehash Rehash pyenv shims (run this after installing executables)
version Show the current Python version and its origin
versions List all Python versions available to pyenv
which Display the full path to an executable
whence List all Python versions that contain the given executable
See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/yyuu/pyenv#readme
めでたしめでたし。
■注意
gitとかbrewとか使わないで手動、という内容なので
pyenv自体の管理も手動。自己負担にて。
pyenv install -l
で、インストール可能なPythonがリストされます。
$ pyenv install -l
Available versions:
2.1.3
2.2.3
2.3.7
2.4
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
2.5
2.5.1
2.5.2
2.5.3
2.5.4
2.5.5
2.5.6
2.6.6
2.6.7
2.6.8
2.6.9
2.7-dev
2.7
中略
pypy3-2.4.0
stackless-dev
stackless-2.7-dev
stackless-2.7.2
stackless-2.7.3
stackless-2.7.4
stackless-2.7.5
stackless-2.7.6
stackless-2.7.7
stackless-2.7.8
stackless-3.2-dev
stackless-3.2.2
stackless-3.2.5
stackless-3.3-dev
stackless-3.3.5
stackless-3.4.1
長い。Python パッケージ管理技術まとめ (pip, setuptools, easy_install, etc)
http://www.yunabe.jp/docs/python_package_management.html#easyinstall-
OSX Yosemiteでpython動作環境を設定した(pyenv + pip)
http://qiita.com/mekkoo/items/0102c571a098ea20b5eb
pyenvを使ってPython環境を構築
http://keisanbutsuriya.hateblo.jp/entry/2015/03/21/183323
yyuu/pyenv
https://github.com/yyuu/pyenv
0 件のコメント:
コメントを投稿