갈루아의 반서재

아나콘다에서 다른 버전의 파이썬 환경을 구축하고자 하는 경우 conda create 명령어를 사용하면 된다. 그럼 현재 파이썬 2.7이 설치된 상황에서 파이썬 3.5 환경을 추가로 구성해보자.




먼저 현재 설정된 아나콘다 환경과 파이썬 버전을 확인해보자.

(* 표시된 것이 현재 로딩된 환경이다)





1
2
3
4
5
root@localhost:~# conda info --envs
# conda environments:
#
envtread              /root/anaconda/envs/envtread
root                */root/anaconda
cs


envtread 라는 이름의 가상환경을 활성화하고 파이썬 버전을 확인해보면 Python 2.7.10 이 설치되어 있음을 알 수 있다.


1
2
3
4
5
6
7
8
9
10
11
root@localhost:~# source activate envtread
discarding /root/anaconda/bin from PATH
prepending /root/anaconda/envs/envtread/bin to PATH
(envtread)root@localhost:~# conda info --envs
# conda environments:
#
envtread              *  /root/anaconda/envs/envtread
root                     /root/anaconda
 
(envtread)root@localhost:~# python --version
Python 2.7.10 :: Anaconda 2.3.(64-bit)
cs


그럼 envsnake35  라는 이름으로 파이썬 3.5 환경을 추가로 구성해보자.


1
$ conda create -n envsnake35 python=3.anaconda
cs



해당 가상환경을 활성화시켜 설치된 파이썬 버전 확인


1
2
3
4
5
6
root@localhost:~# source activate envsnake35
discarding /root/anaconda/bin from PATH
prepending /root/anaconda/envs/envsnake35/bin to PATH
(envsnake35)root@localhost:~# python --version
Python 3.5.:: Anaconda 2.4.(64-bit)
(envsnake35)root@localhost:~#
cs


django 등 설치하여 환경구성을 완료한다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(envsnake35)root@localhost:~/antifragile# source deactivate
discarding /root/anaconda/envs/envsnake35/bin from PATH
root@localhost:~/antifragile# conda install -n envsnake35 Django
root@localhost:~/antifragile# source activate envsnake35
discarding /root/anaconda/bin from PATH
prepending /root/anaconda/envs/envsnake35/bin to PATH
(envsnake35)root@localhost:~/antifragile# python
Python 3.5.|Anaconda 2.4.(64-bit)| (default, Oct 19 201521:57:25)
[GCC 4.4.20120313 (Red Hat 4.4.7-1)] on linux
Type "help""copyright""credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
1.8.4
>>> exit()
(envsnake35)root@localhost:~/antifragile#
cs