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
multiprocessing.freeze_support()
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:
- [Solved] Error: unrecognized arguments: — no site packages
- [Solved] pytest error: error: unrecognized arguments
- Python: How to Solve multiprocessing module Error in Windows
- [Solved] main.py: error: the following arguments are required:
- [Solved] Error: [email protected]: wrong number of arguments (given 1, expected 0)
- Python ValueError: only 2 non-keyword arguments accepted
- [Solved] TypeError: not all arguments converted during string formatting
- [Solved] Matplotlib ERROR: MatplotlibDeprecationWarning: Adding an axes using the same arguments…
- [Solved] train.py: error: the following arguments are required: –XXXX
- Python TypeError: not all arguments converted during string formatting [Solved]
- [Solved] Mongodb security configurate error (unrecognized option: security)
- Tensor for argument #2 ‘mat1‘ is on CPU, but expected it to be on GPU (while checking arguments for
- Python TypeError: Unrecognized value type: <class ‘str‘>dateutil.parser._parser.ParserError: Unknow
- [Solved] error: the following arguments are required (Default parameters are set)
- [Solved] RuntimeError (note: full exception trace is shown but execution is paused at: <module>)
- Parallel processing in Python (Pool.map(), Pool.starmap(), Pool.apply ())
- [Solved] Python Error: An attempt has been made to start a new process before the current process has finished …
- [solution] pyinnstaller package EXE file tutorial
- How to Solve args = parser.parse_args() error
- [Solved] Can‘t pickle local object ‘_createenviron.<locals>.encodekey‘