wkghd1223 / graduate

졸업프로젝트
1 stars 0 forks source link

qt > 실행파일 추출 #26

Open wkghd1223 opened 4 years ago

wkghd1223 commented 4 years ago

pyinstaller 이용

wkghd1223 commented 4 years ago

main.spec 을 만들어

> pyinstaller main.spec

해당 명령어를 실행시킨다.

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None
app_name = 'graduate'

a = Analysis(['main.py'],
             pathex=['${working_derectory}/graduate/NSC/Lib/site-packages/PyQt5/Qt/bin'],
             binaries=[],
             datas=[('./ui/*.ui','./ui')],
             hiddenimports=[
                "agent",
                "chart",
                "data_manager",
                "environment",
                "GetData",
                "newCrawler",
                "news",
                "NewsCrawler",
                "policy_learner",
                "policy_network",
                "settings",
                "test",
                "utils",
                "visualizer",
             ],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          [],
          name=app_name,
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=True )
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               strip=False,
               upx=True,
               name=app_name)

dict/graduate.exe 파일이 성공적으로 만들어졌다. 그러나 아래의 오류가 발생했다. image

wkghd1223 commented 4 years ago
> pip uninstall matplotlib
> pip install matplotlib==3.2.2

image tensorflow가 없다고 해서 main.py파일에

import tensorflow

코드를 삽입했지만 다음 에러가 발생했다. image

그래서 .spec 파일의 hidden import에

...
hiddenimports=[
  "tensorflow",
  "tensorflow_core.python",
...

를 추가했다. image

wkghd1223 commented 4 years ago

tensorflow 1.15 -> 1.14 pyinstaller 3.6 -> 3.5 image site-pakage/astor/__init__.py

ROOT = os.path.dirname(__file__)
with open(os.path.join(ROOT, 'VERSION')) as version_file:
     __version__ = version_file.read().strip()

parse_file = code_to_ast.parse_file

to

ROOT = os.path.dirname(__file__)
# with open(os.path.join(ROOT, 'VERSION')) as version_file:
#     __version__ = version_file.read().strip()
__version__ = '0.8.1'
parse_file = code_to_ast.parse_file

image