2
2

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.

pythonのインストール(pyenv, pyenv-virtualenv)

Last updated at Posted at 2017-04-12

ローカル環境で複数のpythonを使いたいときのメモ
簡単に言うとpyenvはpythonのバージョンを管理するもので、そのプラグインであるpyenv-virtualenvはpythonの環境を作るもの。
pyenv-virtualenvでpythonの環境を閉じ込めて使い分けることができる。

pyenvのインストール

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv
$ echo "export PYENV_ROOT=$HOME/.pyenv" >> .bash_profile
$ echo "export PATH=$PYENV_ROOT/bin:$PATH" >> .bash_profile
$ echo "eval '$(pyenv init -)'" >> .bash_profile

pythonのインストール

$ pyenv install 3.5.0

pyenv-virtualenvのインストール

$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
$ echo 'eval "$(pyenv virtualenv-init -)"' >> .bash_profile

環境の作成

pyenv virtualenv 3.5.2 app # appは環境の名前

環境の設定を有効にする

pyenv activate app # appは先程の名前

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?