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:UsersGhiaPycharmProjectstest>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:UsersGhiaPycharmProjectstestmain.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:usersghiapycharmprojectstestvenvscriptspython.exe
9879 INFO: Analyzing C:UsersGhiaPycharmProjectstestmain.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 FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
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 FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_multiprocessing.pyd
11888 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Lsunicodedata.pyd
11917 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Lsselect.pyd
11945 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_socket.pyd
11988 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_decimal.pyd
12024 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_overlapped.pyd
12072 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_ssl.pyd
12106 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_queue.pyd
12135 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Lspyexpat.pyd
12156 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_asyncio.pyd
12179 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_hashlib.pyd
12208 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_lzma.pyd
12235 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_bz2.pyd
12269 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
Ls_ctypes.pyd
12305 WARNING: lib not found: python39.dll dependency of C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0DL
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:UsersGhiaAppDataLocalMicrosoftWindowsAppsPythonSoftwareFoundation.Python.3.9_qbz5n2kfra
8p0python.exe
12623 WARNING: Reason: 'The file is empty'
Traceback (most recent call last):
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0librunpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:Program FilesWindowsAppsPythonSoftwareFoundation.Python.3.9_3.9.752.0_x64__qbz5n2kfra8p0librunpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:UsersGhiaPycharmProjectstestvenvScriptspyinstaller.exe__main__.py", line 7, in <module>
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstaller__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstaller__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerbuildingbuild_main.py", line 725, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerbuildingbuild_main.py", line 672, in build
exec(code, spec_namespace)
File "C:UsersGhiaPycharmProjectstestmain.spec", line 6, in <module>
a = Analysis(['main.py'],
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerbuildingbuild_main.py", line 242, in __init__
self.__postinit__()
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerbuildingdatastruct.py", line 160, in __postinit__
self.assemble()
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerbuildingbuild_main.py", line 476, in assemble
self._check_python_library(self.binaries)
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerbuildingbuild_main.py", line 569, in _check_python_library
python_lib = bindepend.get_python_library_path()
File "c:usersghiapycharmprojectstestvenvlibsite-packagesPyInstallerdependbindepend.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)
2
Answers
upgrade pip and try to install pyinstaller from github repo
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