파이썬

[파이썬] 가상환경 생성(Anaconda Virtual Environment setup)

mandarinetree 2022. 12. 21. 13:05

1. 아나콘다 설치

 

https://www.anaconda.com/products/distribution

 

Anaconda | Anaconda Distribution

Anaconda's open-source Distribution is the easiest way to perform Python/R data science and machine learning on a single machine.

www.anaconda.com

 

2. Anaconda power shell / Terminal 열기

(Window : Anaconda power shell, MacOS: Terminal)

 

 

3. 가상환경 만들기

 

conda create --name lstm_221221 python=3.7

 

→ lstm_221221 이라는 이름의 가상 환경을 만들거다. 이 가상환경에서의 파이썬 버전은 3.7이다.

 

* 상황에 따라 다른 파이썬 버전을 사용해야 하는 경우가 많기 때문에,(어떤 코드들은 파이썬 0.0 버전에서는 안되고, 어떤 프로젝트를 하려면 파이썬 0.0에 사용하는 버전 환경이 필요하고... 등등) 가상 환경을 만들 때 버전을 어떤걸로 할 것인지 생각해보고 만들어야 한다.

 

(Enter)

Proceed ([y]/n)? y (Enter)

 

 

4. 가상환경으로 접속

 

conda activate  lstm_221221

 (가상환경에서 빠져나올 때는 conda deactivate)

 

5. 가상환경 세팅을 위한 install

 

pip install jupyter notebook (Enter)

pip install ipykernel (Enter)

python -m ipykernel install --user --name lstm_221221--display-name lstm_221221 (Enter)

 

6. 쥬피터 노트북 설치

 

conda install jupyter notebook (Enter)

Proceed ([y]/n)? y (Enter)

 

7. 필요한 라이브러리 install

 

conda install numpy

conda install pandas

conda install matplotlib

conda install seaborn

conda install scikit-learn

 

 

또는 conda install numpy pandas matplotlib seaborn scikit-learn

 

8. 모든 설치가 끝나면 jupyter notebook 타이핑해서 실행