I have a code for predicting some value that uses xgboost
package in the code. When I run it in PyCharm, it runs as expected.
The problem is when I make an executable file using pyinstaller
. It will make the exe
without any error, but when I run it the following error is raised:
Traceback (most recent call last):
File "test_fraud.py", line 3, in <module>
import xgboost
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File
"C:UsersShubhamSinghPycharmProjectscfna_scoringvenvlibsite-
packagesPyInstallerloaderpyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "libsite-packagesxgboost\__init__.py", line 11, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "C:UsersShubhamSinghPycharmProjectscfna_scoringvenvlibsite-
packagesPyInstallerloaderpyimod03_importers.py", line 627, in
exec_module
exec(bytecode, module.__dict__)
File "libsite-packagesxgboostcore.py", line 161, in <module>
File "libsite-packagesxgboostcore.py", line 123, in _load_lib
File "libsite-packagesxgboostlibpath.py", line 48, in find_lib_path
xgboost.libpath.XGBoostLibraryNotFound: Cannot find XGBoost Library in
the candidate path, did you install compilers and run build.sh in root
path?
List of candidates:
C:UsersSHUBHA~1AppDataLocalTemp\_MEI11402xgboostxgboost.dll
C:UsersSHUBHA~1AppDataLocalTemp\_MEI11402xgboost
../../lib/xgboost.dll
C:UsersSHUBHA~1AppDataLocalTemp\_MEI11402xgboost./lib/xgboost.dll
C:UsersSHUBHA~1AppDataLocalTemp\_MEI11402xgboostxgboost.dll
C:UsersSHUBHA~1AppDataLocalTemp\_MEI11402xgboost
../../windows/x64/Release/xgboost.dll
C:UsersSHUBHA~1AppDataLocalTemp\_MEI11402
xgboost./windows/x64/Release/xgboost.dll
[6564] Failed to execute script test_fraud
What's wrong here?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…