728x90
728x90

Linux, macOS
which python
- 실행되는 Python의 경로를 보여줌.
Windows
where python
- 실행되는 Python의 경로를 보여줌.
Python shell (패키지 및 python library위치)
# 사용중인 python 경로
import sys
print(sys.executable)
# python library
from distutils.sysconfig import get_python_lib
print(get_python_lib())
# package들이 설치된 경로
import site
print(site.getsitepackages())
# 시스템의 path정보로도 확인 가능.
import sys
print(sys.path)
# 개별 import <target_module>
print( <target_module>.__file__)
- 여기서
<target_module>은numpy등의 실제 위치를 알고 싶은 라이브러리나 모듈을 가르킴. - sys.path는 module search path 에 해당함.
2023.06.18 - [Programming] - [Python] Module Search Path and sys.path
[Python] Module Search Path and sys.path
Module Search Path and sys.path1. Module Search PathPython 에서 module을 찾는 경로 (Module Search Path)는 다음의 순서별로 우선권을 가짐.home directory of the program (main script file이 있는 위치 or python shell이 수행된 cwd)m
dsaint31.tistory.com
같이 보면 좋은 자료들
2021.10.17 - [Computer/ETC] - Path (경로)
Path (경로)
파일 시스템 내에서 특정 파일(혹은 디렉토리)의 위치를 나타내는 문자열Absolute Path (절대 경로)현 작업디렉토리(cwd)와 관계없이 절대적 위치드라이브:\폴더\폴더\파일명 (Windows)c:\Windows\System32\dri
dsaint31.tistory.com
728x90
'Programming' 카테고리의 다른 글
| [NumPy] sorting: 정렬 (1) | 2022.09.10 |
|---|---|
| Paradigm (패러다임) (0) | 2022.07.21 |
| [Error: Tensorboard] ImportError: cannot import name 'Mapping' from 'collections' (1) | 2022.05.18 |
| [ML] Entropy, KL-Divergence, and Cross-entropy (0) | 2022.05.12 |
| [Conda] miniconda의 기본 채널 변경 : conda-forge (3) | 2022.04.05 |