After the virtual environment was built, the Python file was made EXE with the pyinstaller Python filename --onefile --noconsole
.
After that, I tried to do it, but the following error (attached image) occurred.
Apparently, there is no module called cftime, so I was going to install it with pip, but when I was installing the package called netCDF4, it was installed together as follows:
(project_env)PST:\PROJECT_Automation>python-mpip install netCDF4
Collecting netCDF4
Using cached netCDF4-1.5.8-cp37-cp37m-win_amd64.whl (3.0 MB)
Requirement already satified: numpy>=1.9 int:\project_automation\project_env\lib\site-packages (from netCDF4) (1.21.6)
Collecting cftime
Using cached cftime-1.6.0-cp37-none-win_amd64.whl (154 kB)
Installing collected packages: cftime, netCDF4
Successfully installed cftime-1.6.0 netCDF4-1.5.8
In fact, when I checked with T:\PROJECT_Automation\project_env\Lib\site-packages, it was installed.
Why do I get an error saying I can't find the module?
I don't know how to solve it.
Thank you for your understanding.
This article seems to deal with the same problem.
It has not been answered, but it has been updated with comments, so it seems to have been resolved.
PyInstaller cftime module not found
add the flag -- hidden-imports cftime to your command.
Because you don't import the module directly, pyinstaller may not realize that's a needed dependency.
It works! Thank you very much!
However, you should add --hidden-imports cftime
, but you should actually have --hidden-import
at the end without s
and --hidden-imports cftime
.
Maybe it depends on the number of versions of PyInstaller.
The above article shows the source code and procedures for reproducing the problem, and we did so.
(I have updated the number of versions of pip and setuptools)
And as you can see in the comment (actually removing s
), the error disappeared and it now works.
The same is true of the question, so try it.
577 PHP ssh2_scp_send fails to send files as intended
884 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
572 Understanding How to Configure Google API Key
567 Who developed the "avformat-59.dll" that comes with FFmpeg?
603 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.