简体   繁体   中英

How can i import train_test_split to pyinstaller executable file?

Hi everyone i had some problems, but while i am solving them new ones are coming. For example after i have converted the py file to exe file i was getting No module named "numpy.random.common" error so i solved this with --hidden-import = "...". In my program i am using train_test_split library to split the data to train and test sets. When i open the exe file i can not do this so i recognized that in the dist file there is a sklearn file but in the sklearn file there is no model_selection file so i think my problem is that,how can i import the sklearn.model_selection.train_test_split to pyinstaller exe ? I have tried --hidden-import="sklearn.model_selection.train_test_split" but it didn't work. Thank you.

I have found the solution, I have defined from sklearn.model_selection import train_test_split in the def ..(): then i have removed it, and write on the top of the main code. When i convert the py file it gave me an error like :

ModuleNotFoundError: No module named 'sklearn.neighbors.ball_tree.NeighborsHeap'

i write it like --hidden-import="sklearn.neighbors.ball_tree.NeighborsHeap" so it is solved.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM