파이썬

파이썬, 윈도우 환경에서 실행파일 만들기 (windows10)

LEEHANDS 2021. 6. 21. 10:09
반응형

1. pyinstaller 설치하기

 

pip install pyinstaller

 

2. 실행파일 만들기

pyinstaller sample.py

2-1 실행파일 옵션

콘솔창 출력되지 않도록하기 (-w)

pyinstaller -w sample.py

실행파일 하나만 생성하기

pyinstaller -w -F sample.py

 

 

3. 실행파일이 자동으로 꺼지는 형상 Debugging

Traceback (most recent call last):
  File "PyInstaller\loader\pyiboot01_bootstrap.py", line 167, in __init__
  File "ctypes\__init__.py", line 381, in __init__
FileNotFoundError: Could not find module 'libusb-1.0.dll' (or one of its dependencies). Try using the full path with constructor syntax.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "main.py", line 5, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "usb1\__init__.py", line 61, in <module>
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
  File "usb1\libusb1.py", line 183, in <module>
  File "usb1\libusb1.py", line 157, in _loadLibrary
  File "PyInstaller\loader\pyiboot01_bootstrap.py", line 169, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'libusb-1.0.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[16644] Failed to execute script main

에러

 

 

반응형