Python

프로젝트를 수행하다보면 공통 모듈을 생성하여 다른사람 또는 스스로 재활용해야할 경우가 자주 발생힙니다. 파이썬 공식 문서를 참고하여 패키지 만드는 방법을 정리하겠습니다. 참고 : Python 공식문서 6. Modules If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are bett... docs.python.org 파이썬 패키지는 dotted module names 를 사용하여 구조화 하고 있습니다. 즉, 패키지 내 ..
프로젝트 중 Python 으로 Oracle 에 접근하여 데이터를 가지고 오는 작업을 수행할 일이 생겨 Mac에서 접근할 수 있는 방법을 정리해보았습니다. 환경 : Mac OS DB : Oracle 사용언어 : Python 1. Oracle Client Download Version 19.8.0.0.0 Instant Client for macOS (Intel x86) DMG 파일 다운로드 다운로드 된 파일을 더블 클릭하고 삽입되도록 한 후 아래 내용을 수행 cd /Volumes/instantclient-basic-macos.x64-19.8.0.0.0dbru ./install_ic.sh # downlaod 폴더에 다운로드가 됨. /Users/dave/Downloads/instantclient_19_8 Cre..
python 에서 VirtualEnv 생성 후 Activate 를 할 때 에러가 날 경우가 있다. 시스템에서 스크립트를 실행할 수 없으므로 evenv\Scripts\activate.ps1 파일을 로드할 수 없습니다. 자세한 내용 은 about_Execution_Policies(https://go.microsoft.com/fwlink/?LinkID=135170)를 참조하십시오. 위치 줄:1 문자:1 + .\envs\Scripts\activate + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : 보안 오류: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess 위와 같이 에러가 발생할 경우..
오프라인 상태에서 다양한 패키지가 필요한 상황이 있다. 온라인이 되는 PC에서 아래와 같이 하면 whl 파일이 다운로드 된다. 다운로드 pip download -d . pymssql설치. pip install --no-index -f 폴더 whl명
Jupyter Notebook 에 가상환경 커널 추가하는 방법 가상 환경을 만들 후 Activate 시킨 후 Jupyter notebook을 수행하게 되면 가끔 내가 만든 가상 환경의 커널이 없을 경우가 있다. conda install ipykernel # 또는 pip install ipykeynel설치 후 python -m ipykernel install --user --name py38 --display-name "py38" # --name py38 : 가상환경 이름 # --display-name "py38" : 보여질 커널 이름.
가상 환경 bit별로 생성 방법 및 오류 해결 인터넷 검색하면 아래와 같은 설명이 많았다. set CONDA_FORCE_32BIT=1 conda create -n py38_32 python=3.8 이렇게 하더라도 실제적으로 확인 결과 아래와 같이 64비트로 유지되었다. 참조 : https://baessi.tistory.com/134?category=1083198 를 통해 다른 방법으로 가상 환경을 만들 수 있었다. 가상환경 생성 1. 기존 방식으로 가상환경 생성. conda create -n py38_32 python=3.8 2. 설치 이후 활성화 conda activate py38_32 3. 버전 확인 python 실행 import platform print(platform.architecture())..
Image 다루기 Gitpage를 운영하다보니 Card 이미지에 나오는 이미지 크기를 균일하게 다룰 필요가 있어 찾아본 방법 Library python3 기준 pip install Pillow Pillow 내 PIL library를 이용 할 것이다. How to import glob # file List imglist = glob.glob("D:/GithubPages/images/*.png") img = Image.open(imglist[0]) print(img.size) # (400,250) tuple 형태로 출력. 즉, 나중에 Resizing 을 할때도 Tuple로 입력. img.show() # 이미지 확인 img.resize((100,10)).show() # Resizing 이후 다시 확인 for ..
J_Today
'Python' 태그의 글 목록