简体   繁体   中英

need help on pyinstaller in pycharm

I'm trying to build an exe file from my pycharm project but it did not succeed. I've tried several solutions from the Internet but they didn't work for me. there was nothing in the dist folder. the statement I used was "pyinstaller main.py". I also upgraded pyinstaller from 4.2 to 5.0 and it still didn't work. please help. Thanks

Here is the output from both Pycharm terminal.

Microsoft Windows [Version 10.0.18363.1440]
(c) 2019 Microsoft Corporation. All rights reserved.

(venv) C:\Users\Ghia\PycharmProjects\test>pyinstaller main.py
130 INFO: PyInstaller: 4.2
130 INFO: Python: 3.9.2
130 INFO: Platform: Windows-10-10.0.18362-SP0
130 INFO: wrote C:\Users\Ghia\PycharmProjects\test\main.spec
137 INFO: UPX is not available.
140 INFO: Extending PYTHONPATH with paths
['C:\\Users\\Ghia\\PycharmProjects\\test',
 'C:\\Users\\Ghia\\PycharmProjects\\test']
150 INFO: checking Analysis
150 INFO: Building Analysis because Analysis-00.toc is non existent
159 INFO: Initializing module dependency graph...
170 INFO: Caching module graph hooks...
190 WARNING: Several hooks defined for module 'win32ctypes.core'. Please take care they do not conflict.
199 INFO: Analyzing base_library.zip ...
6866 INFO: Processing pre-find module path hook distutils from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks\\pre
_find_module_path\\hook-distutils.py'.
6870 INFO: distutils: retargeting to non-venv dir 'C:\\Program Files\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\\lib'

9638 INFO: Caching module dependency graph...
9848 INFO: running Analysis Analysis-00.toc
9856 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\users\ghia\pycharmprojects\test\venv\scripts\python.exe
9879 INFO: Analyzing C:\Users\Ghia\PycharmProjects\test\main.py
10145 INFO: Processing module hooks...
10146 INFO: Loading module hook 'hook-difflib.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10148 INFO: Excluding import of doctest from module difflib
10148 INFO: Loading module hook 'hook-distutils.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10150 INFO: Loading module hook 'hook-encodings.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10459 INFO: Loading module hook 'hook-heapq.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10461 INFO: Excluding import of doctest from module heapq
10462 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks
'...
10464 INFO: Excluding import of test from module multiprocessing.util
10464 INFO: Excluding import of test.support from module multiprocessing.util
10464 INFO: Loading module hook 'hook-pickle.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10466 INFO: Excluding import of argparse from module pickle
10466 INFO: Loading module hook 'hook-sysconfig.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10468 INFO: Loading module hook 'hook-xml.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10838 INFO: Loading module hook 'hook-_tkinter.py' from 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks'...
10850 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_tkinter.pyd
11370 INFO: checking Tree
11489 INFO: checking Tree
11779 INFO: checking Tree
11819 INFO: Looking for ctypes DLLs
11824 INFO: Analyzing run-time hooks ...
11829 INFO: Including run-time hook 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessi
ng.py'
11834 INFO: Including run-time hook 'c:\\users\\ghia\\pycharmprojects\\test\\venv\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth__tkinter.py'
11843 INFO: Looking for dynamic libraries
11860 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_multiprocessing.pyd
11888 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\unicodedata.pyd
11917 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\select.pyd
11945 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_socket.pyd
11988 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_decimal.pyd
12024 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_overlapped.pyd
12072 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_ssl.pyd
12106 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_queue.pyd
12135 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\pyexpat.pyd
12156 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_asyncio.pyd
12179 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_hashlib.pyd
12208 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_lzma.pyd
12235 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_bz2.pyd
12269 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_ctypes.pyd
12305 WARNING: lib not found: python39.dll dependency of C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\DL
Ls\_tkinter.pyd
12621 INFO: Looking for eggs
12621 INFO: Python library not in binary dependencies. Doing additional searching...
12623 WARNING: Can not get binary dependencies for file: C:\Users\Ghia\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra
8p0\python.exe
12623 WARNING:   Reason: 'The file is empty'
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\Ghia\PycharmProjects\test\venv\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\__main__.py", line 114, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 725, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 672, in build
    exec(code, spec_namespace)
  File "C:\Users\Ghia\PycharmProjects\test\main.spec", line 6, in <module>
    a = Analysis(['main.py'],
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 242, in __init__
    self.__postinit__()
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
    self.assemble()
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 476, in assemble
    self._check_python_library(self.binaries)
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\building\build_main.py", line 569, in _check_python_library
    python_lib = bindepend.get_python_library_path()
  File "c:\users\ghia\pycharmprojects\test\venv\lib\site-packages\PyInstaller\depend\bindepend.py", line 945, in get_python_library_path
    raise IOError(msg)
OSError: Python library not found: python39.dll, libpython3.9m.dll, libpython3.9.dll, libpython39.dll, libpython39m.dll
    This would mean your Python installation doesn't come with proper library files.
    This usually happens by missing development package, or unsuitable build parameters of Python installation.

    * On Debian/Ubuntu, you would need to install Python development packages
      * apt-get install python3-dev
      * apt-get install python-dev
    * If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)


upgrade pip and try to install pyinstaller from github repo

python.exe -m pip install --upgrade pip
python.exe -m pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

after that try to build exe file. pyinstaller "filename"

'pyinstaller' is not recognized as an internal or external command, operable program or batch file. it gave me this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM