Help us understand the problem. What is going on with this article?

[Python]Anacondaで仮想環境を作る

More than 3 years have passed since last update.

Anacondaで仮想環境を作る方法

とりあえず何でもいいのでAnacondaが入っていること。

仮想環境を作る

conda create -n 仮想環境の名前 python=x.x インストールするパッケージを羅列(区切り文字はスペース)

例)

conda create -n py27 python=2.7 anaconda

Proceed ([y]|n)?って聞かれるのでyを押す

仮想環境の確認

conda info -e

# conda environments:
#
chainer                  /home/user/anaconda2/envs/chainer
py27                     /home/user/anaconda2/envs/py27
py35                     /home/user/anaconda2/envs/py35
tensorflow               /home/user/anaconda2/envs/tensorflow
root                  *  /home/user/anaconda2

仮想環境の削除

conda remove -n py27 --all

conda info -e

# conda environments:
#
chainer                  /home/user/anaconda2/envs/chainer
py35                     /home/user/anaconda2/envs/py35
tensorflow               /home/user/anaconda2/envs/tensorflow
root                  *  /home/user/anaconda2

仮想環境をActiveにする

user@MYPC:~$ source activate py27
discarding /home/user/anaconda2/bin from PATH
prepending /home/user/anaconda2/envs/py27/bin to PATH
(py27)user@MYPC:~$ conda info -e
# conda environments:
#
chainer                  /home/user/anaconda2/envs/chainer
py27                  *  /home/user/anaconda2/envs/py27
py35                     /home/user/anaconda2/envs/py35
tensorflow               /home/user/anaconda2/envs/tensorflow
root                     /home/user/anaconda2

windowsの場合はactivate py27でActiveにする

仮想環境を非Activeにする

(py27)user@MYPC:~$ source deactivate
discarding /home/user/anaconda2/envs/py27/bin from PATH
user@MYPC:~$ conda info -e
# conda environments:
#
chainer                  /home/user/anaconda2/envs/chainer
py27                     /home/user/anaconda2/envs/py27
py35                     /home/user/anaconda2/envs/py35
tensorflow               /home/user/anaconda2/envs/tensorflow
root                  *  /home/user/anaconda2

windowsの場合は、deactivateで非アクティブにする

詳細は下記ドキュメントに書いてある
conda document

テスト環境:
OS: Ubuntu 14.04 LTE

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away