제 포스트에서 https://walkaroundthedevelop.tistory.com/127
Anaconda 가상환경을 jupyter notebook에서 사용하기
Jupyter Notebook은 여러 개의 파이썬 스크립트를 순차적으로 실행하고 디버깅 해볼 수 있도록 가능하게 하는 좋은 툴입니다. 하지만 항상 머신러닝에서 그러듯이, 가상환경과 라이브러리 인스톨하
walkaroundthedevelop.tistory.com
python conda 환경을 kernel에서 어떻게 사용하는지 포스팅을 썼습니다.
gcp vertex ai 에서 이렇게 했는데도 python version이 바뀌지 않는 것을 발견했습니다.
!python3 --version
!which python3
!which jupyter
Python 3.10.13
/opt/conda/bin/python3
/opt/conda/bin/jupyter
import sys
print(sys.executable)
print(sys.version)
/opt/conda/envs/tfx/bin/python3
3.8.19 | packaged by conda-forge | (default, Mar 20 2024, 12:47:35)
[GCC 12.3.0]
import sys
print(sys.executable)
!{sys.executable} --version
/opt/conda/envs/tfx/bin/python3
Python 3.8.19
결국 알게된 사실은, !를 쓰기보단 그 Kernel에 관련된 python을 쓰기 위해서는 %를 써야된다는 점이었습니다.
In Jupyter notebooks, the exclamation mark (!) and the percent sign (%) are used as prefixes for different purposes. The exclamation mark is used to execute shell commands from the notebook's environment, while the percent sign is used for magic commands, which are specific to and interpreted by the IPython kernel Jupyter runs on.
이게 Vertex AI workbench에만 해당되는 사항인지는 잘 모르겠지만, %라는 커맨드를 알아서 좋은거같습니다.
'환경설정' 카테고리의 다른 글
linux 18.04 + geforce 2080 ti Pytorch gpu 사용 환경 구축 (with anaconda) (1) | 2024.12.09 |
---|---|
리눅스에서 C++ (G++?) 설정하기 (0) | 2023.06.09 |
anaconda를 사용한 tensorflow lite 환경설정 (0) | 2022.08.26 |
Anaconda 가상환경을 jupyter notebook에서 사용하기 (0) | 2022.07.20 |
아나콘다 가상환경 클론하기 (0) | 2021.03.23 |