[Solved] error: unrecognized arguments: –multiprocessing-fork

Problem description

Using pyinstaller to package the project into an executable file, we encountered the above problems after solving various problems. The project we wrote needs to use multiple processes, but this problem will occur if the process is not successfully created.

Solution 1

I think others’ solutions are as follows:

if __name__ == '__main__':
	# The following sentence must be added below the if

Solution 2

The general search answer is scheme 1, but this does not apply to me. As a result, the problem bothered me for two days. Just realized that if you use argparse in your code, package it into an executable file, and use multiple processes, you are likely to report this error. After I modified argparse and packaged it into an executable file, multiple processes can be started normally.

Read More: