You should post the whole code,when having modules like selenium, xlrd there is outside dependencies(like web-driver) on OS.
It can be difficult to analyse error when making .exe and it fails.
I have done Selenium before with Pyinstaller,i think there where some step i had to do,don't remember as it's a long time ago.
Look at this
post how i build and troubleshoot(with virtual environment) to get Pandas to work in one .exe file.
Basic test to make sure that pynstaller work.
# power.py
def power_of(arg):
'''Calulate Powers of exponent(^) in python'''
return arg ** arg
if __name__ == '__main__':
user_input = int(input('Enter number to perform power of exponent: '))
print(power_of(user_input))
input('Press <Enter> to exit')
The build for this will be one file and it's console app.
pyinstaller --onefile --console power.py
The whole run,with some explanations
Output:
E:\div_code\pyist
# Test before that it work
λ python power.py
Enter number to perform power of exponent: 55
524744532468751923546122657597368049278513737089035272057324643668607677682302892208099365234375
Press <Enter> to exit
# Check that pyinstaller is updated
E:\div_code\pyist
λ pip install pyinstaller --upgrade
Requirement already up-to-date: pyinstaller in c:\python37\lib\site-packages (3.4)
Requirement already satisfied, skipping upgrade: setuptools in c:\python37\lib\site-packages (from pyinstaller) (39.0.1)
Requirement already satisfied, skipping upgrade: pefile>=2017.8.1 in c:\python37\lib\site-packages (from pyinstaller) (2018.8.8)
Requirement already satisfied, skipping upgrade: altgraph in c:\python37\lib\site-packages (from pyinstaller) (0.16.1)
Requirement already satisfied, skipping upgrade: macholib>=1.8 in c:\python37\lib\site-packages (from pyinstaller) (1.10)
Requirement already satisfied, skipping upgrade: pywin32-ctypes in c:\python37\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied, skipping upgrade: future in c:\python37\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.17.1)
# Bulid
E:\div_code\pyist
λ pyinstaller --onefile --console power.py
213 INFO: PyInstaller: 3.4
213 INFO: Python: 3.7.0
214 INFO: Platform: Windows-10-10.0.17134-SP0
216 INFO: wrote E:\div_code\pyist\power.spec
348 INFO: UPX is not available.
667 INFO: Extending PYTHONPATH with paths
['E:\\div_code\\pyist', 'E:\\div_code\\pyist']
667 INFO: checking Analysis
667 INFO: Building Analysis because Analysis-00.toc is non existent
667 INFO: Initializing module dependency graph...
674 INFO: Initializing module graph hooks...
679 INFO: Analyzing base_library.zip ...
6994 INFO: running Analysis Analysis-00.toc
7023 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\python37\python.exe
8472 INFO: Caching module hooks...
8504 INFO: Analyzing E:\div_code\pyist\power.py
8508 INFO: Loading module hooks...
8509 INFO: Loading module hook "hook-encodings.py"...
8721 INFO: Loading module hook "hook-pydoc.py"...
8723 INFO: Loading module hook "hook-xml.py"...
9184 INFO: Looking for ctypes DLLs
9184 INFO: Analyzing run-time hooks ...
9192 INFO: Looking for dynamic libraries
10307 INFO: Looking for eggs
10307 INFO: Using Python library c:\python37\python37.dll
10308 INFO: Found binding redirects:
[]
10313 INFO: Warnings written to E:\div_code\pyist\build\power\warn-power.txt
10375 INFO: Graph cross-reference written to E:\div_code\pyist\build\power\xref-power.html
10405 INFO: checking PYZ
10406 INFO: Building PYZ because PYZ-00.toc is non existent
10406 INFO: Building PYZ (ZlibArchive) E:\div_code\pyist\build\power\PYZ-00.pyz
11273 INFO: Building PYZ (ZlibArchive) E:\div_code\pyist\build\power\PYZ-00.pyz completed successfully.
11281 INFO: checking PKG
11281 INFO: Building PKG because PKG-00.toc is non existent
11281 INFO: Building PKG (CArchive) PKG-00.pkg
13103 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
13108 INFO: Bootloader c:\python37\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe
13109 INFO: checking EXE
13109 INFO: Building EXE because EXE-00.toc is non existent
13109 INFO: Building EXE from EXE-00.toc
13110 INFO: Appending archive to EXE E:\div_code\pyist\dist\power.exe
13133 INFO: Building EXE from EXE-00.toc completed successfully.
E:\div_code\pyist
λ ls
__pycache__/ build/ dist/ power.py power.spec
E:\div_code\pyist
λ cd dist
# In dist folder test power.exe or double click on power.exe file explorer
E:\div_code\pyist\dist
λ ls
power.exe*
E:\div_code\pyist\dist
λ power
Enter number to perform power of exponent: 55
524744532468751923546122657597368049278513737089035272057324643668607677682302892208099365234375
Press <Enter> to exit