LoginSignup
2
6

More than 5 years have passed since last update.

【python】virtualenv作成手順メモ

Posted at

同一サーバー上で、異なるライブラリのバージョンに依存しているプロジェクトを持つことが多かった。そこで、virtualenvを用いて、独立したPython環境を指定できるようにするのが便利なため、その手順のメモ。

virtualenvのインストール

 $ sudo conda install virtualenv
# $ sudo pip install --upgrade virtualenv (pipの場合)

virtualenvの環境の作成

 $ virtualenv --system-site-packages targetDirectory # for Python 2.7
 $ virtualenv --system-site-packages -p python3 targetDirectory # for Python 3.n

virtualenv環境のアクティベート

 $ source targteDirectory/bin/activate

これによって、プロンプトが以下のように切り替わる

(targteDirectory)$

virtualenv環境のディアクティベート

(targteDirectory)$ deactivate
2
6
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
6