[Python] 현재 사용 중인 Python 및 패키지의 실제 경로 확인하기.

2022. 7. 18. 17:04·Programming
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
'Programming' 카테고리의 다른 글
  • [NumPy] sorting: 정렬
  • Paradigm (패러다임)
  • [Error: Tensorboard] ImportError: cannot import name 'Mapping' from 'collections'
  • [ML] Entropy, KL-Divergence, and Cross-entropy
dsaint31x
dsaint31x
    반응형
    250x250
  • dsaint31x
    Dsaint31's blog
    dsaint31x
  • 전체
    오늘
    어제
    • 분류 전체보기 (787)
      • Private Life (15)
      • Programming (55)
        • DIP (116)
        • ML (35)
      • Computer (120)
        • CE (54)
        • ETC (33)
        • CUDA (3)
        • Blog, Markdown, Latex (4)
        • Linux (9)
      • ... (368)
        • Signals and Systems (115)
        • Math (176)
        • Linear Algebra (33)
        • Physics (43)
        • 인성세미나 (1)
      • 정리필요. (61)
        • 의료기기의 이해 (6)
        • PET, MRI and so on. (7)
        • PET Study 2009 (1)
        • 방사선 장해방호 (5)
        • 방사선 생물학 (3)
        • 방사선 계측 (9)
        • 기타 방사능관련 (3)
        • 고시 (9)
        • 정리 (18)
      • RI (0)
      • 원자력,방사능 관련법 (2)
  • 블로그 메뉴

    • Math
    • Programming
    • SS
    • DIP
  • 링크

    • Convex Optimization For All
  • 공지사항

    • Test
    • PET Study 2009
    • 기타 방사능관련.
  • 인기 글

  • 태그

    Python
    math
    fourier transform
    SS
    Optimization
    Probability
    signal_and_system
    인허가제도
    ML
    function
    cv2
    signals_and_systems
    linear algebra
    Vector
    random
    Term
    numpy
    opencv
    SIGNAL
    Programming
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
dsaint31x
[Python] 현재 사용 중인 Python 및 패키지의 실제 경로 확인하기.
상단으로

티스토리툴바