339
368

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]Anacondaで仮想環境を作る

Last updated at Posted at 2015-12-26

#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

339
368
5

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
339
368

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?