4
4

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.

python2&3の環境構築(OSX)

Posted at

自分向け、Python構築メモ。
homebrewは入っている前提で、書きます。
とりあえず以下の手順で頑張ります。

$ brew install pyenv
$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ exec $SHELL
$ pyenv install 2.7.9
$ pyenv install 3.4.3
$ pyenv global 2.7.9 3.4.3

ここまでできたら、あとは以下の通りに…。

$ python --version
Python 2.7.9
$ python2 --version
Python 2.7.9
$ python3 --version
Python 3.4.3

そしてこんなことができます。

$ pip --version
pip 6.1.1 from /Users/mypc/.pyenv/versions/2.7.9/lib/python2.7/site-packages (python 2.7)
$ pip2 --version
pip 6.1.1 from /Users/mypc/.pyenv/versions/2.7.9/lib/python2.7/site-packages (python 2.7)
$ pip3 --version
pip 6.0.8 from /Users/mypc/.pyenv/versions/3.4.3/lib/python3.4/site-packages (python 3.4)

これでpythonのバージョン別でpipが使い分けられますね。

4
4
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
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?