47
46

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 5 years have passed since last update.

OSXでpyenvインストールメモ

Posted at

環境 macosx10.8(ホストOS)

ansibleを使う雰囲気になってきたのでちょっとローカルに入れるか!!と思ったので
その前にpythonのバージョン管理ができるpyenvを入れようと思った時のメモ
rbenvとかと一緒でenv系のpython版ですね
rbenvがわからない方はコチラを参考にしてみてください。

参考にしたサイト

事前準備が必要なもの

homebrewのアップデート

サクッと

brew update
brew install pyenv

.bashrcもしくは.bash_profileの追加

rbenvと同じですね

echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bash_profile

.bash_profileの反映

これだけ

source .bash_profile

## 確認

pyenv --help

yenv 0.4.0-20130726
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 the python-build plugin
   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

インストールしてみる

下記のコマンドでインストールできるバージョン一覧が見れます

pyenv install -l
pyenv install 3.3.2

Downloading readline-6.2.tar.gz...
-> http://yyuu.github.io/pythons/67948acb2ca081f23359d0256e9a271c
Installing readline-6.2...
Installed readline-6.2 to /Users/ユーザー名/.pyenv/versions/3.3.2

Downloading Python-3.3.2.tgz...
-> http://yyuu.github.io/pythons/0a2ea57f6184baf45b150aee53c0c8da
Installing Python-3.3.2...
Installed Python-3.3.2 to /Users/ユーザー名/.pyenv/versions/3.3.2

Downloading setuptools-0.9.7.tar.gz...
-> https://pypi.python.org/packages/source/s/setuptools/setuptools-0.9.7.tar.gz
Installing setuptools-0.9.7...
Installed setuptools-0.9.7 to /Users/ユーザー名/.pyenv/versions/3.3.2

Downloading pip-1.4.tar.gz...
-> https://pypi.python.org/packages/source/p/pip/pip-1.4.tar.gz
Installing pip-1.4...
Installed pip-1.4 to /Users/ユーザー名/.pyenv/versions/3.3.2

pythonのグローバル設定をする

デフォルトで使用するpythonのバージョンを指定しないと
macのデフォルトのpythonをみてしまうので設定しましょう

pyenv global 3.3.2
python --version
Python 3.3.2

まあ、基本rbenvと一緒なので
rbenv入れた人なら問題なく入れられるかと思います。

47
46
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
47
46

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?