LoginSignup
1
2

More than 3 years have passed since last update.

Pythonの隔離環境(venv環境)を作成する手順

Posted at

Pythonの隔離環境を作成する手順

とりあえずpyenvインストール

$ git clone https://github.com/yyuu/pyenv.git ~/.pyenv

特定のバージョンをインストール

$ pyenv install 3.7.3

隔離環境のベースになるディレクトリを作成して移動

$ mkdir sandbox
$ cd sandbox

ローカルバージョンを指定

$ pyenv local 3.7.3

venv環境を作成

$ python -m venv venv

venv環境に切り替え

$ source venv/bin/activate

使用しているpythonの確認

$ which python
~/sandbox/venv/bin/python
1
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
1
2