LoginSignup
8
11

More than 5 years have passed since last update.

venvで環境構築

Last updated at Posted at 2019-01-09

venvは、同じ(python)バージョンで違う環境を作成するためのもの

事前準備

venvはvirtualenvがPython 3.3から標準機能として取り込まれたものなので、Python 3.3以上をインストール

仮想環境構築

$ python -m venv env

envフォルダができてその中にいろいろインストールされる

envは仮想環境名(任意に設定できる)

※パスにスペースが入ってるとエラーになることがありました。

仮想環境に入る

$ source env/bin/activate
(env)$ 

この状態でTensorflowのインストールなどを行う。

envフォルダの中(仮想環境)にインストールされるのでOS環境が汚れない。

例:Tensorflowのインストール

(env)$ pip install tensorflow

仮想環境から出る

(env)$ deactivate

仮想環境の削除

envフォルダを削除すればいい

8
11
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
8
11