After freezing my program with PyInstaller, I encountered following error while trying to run the executable:
ModuleNotFoundError: No module named 'numpy.distutils'
After adding numpy.distutils
to hidden imports, I am getting a new error:
ImportError: cannot import name 'ccompiler' from partially initialized module 'numpy.distutils' (most likely due to a circular import)
with which I don't know what to do. Those are imports from my code :
import pyodbc
import numpy as np
import fiona
import pandas as pd
import geopandas as gpd
import rasterio
from rasterio import features
from rasterstats import zonal_stats
import PySimpleGUI as sg
Try to collect all submodules of Numpy
--collect-submodules numpy
then, you may get a new error or others
ModuleNotFoundError: No module named 'distutils.unixccompiler'
Adding them to hidden imports
--hidden-import distutils.unixccompiler
Just update to Pyinstaller 4.8. They fix this error in this release.
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.