본문 바로가기
python

[라즈베리파이] 파이썬 실행파일 만들기 (Python executable file on Raspberry Pi)

by codingcampus 2024. 10. 10.
반응형
SMALL

Python으로 개발한 프로그램을 소스 파일이 아니라 실행 파일(exe) 형태로 배포하고 싶을 때

 

아래와 같이 하면 됩니다.

1. pyinstaller 설치 하기

    sudo apt-get install python-setuptools

    sudo pip3 install pyinstaller

2. 실행 파일 만들기

    pyinstall --onefile your_file.py

    --> 진행 과정이 화면에 디스플레이 됨... 1~2분정도 지난 후 

         실행 가능한 your_file 파일이 dist 폴더에 생성됨

3. 위에서 생성한 파일 실행 시 다음 오류가 뜰 때

        ImportError: numpy.core.multiarray failed to import

    옵션을 추가하여 다시 실행 파일을 만든다.

        pyinstaller --onefile your_file.py --hidden-import=numpy.core.multiarray

 

반응형
LIST