I made a program, the main program is osrr.py, which imports the other two files excela.py and excelb.py. When I run in visual studio, the program can run normally, but after I use pyinstaller to package it into a separate EXE file, the operation will report an error of “importerror”, but there is no prompt to import which name, The packing command is: pyinstall – F osrr.py – P excela.py – P excelb.py — hidden import excela — hidden import excelb. The error is as shown in the figure below
Problem solving process:
when I didn’t create a new excelb.py, osrr.py and excel.py can be packaged normally. When I created a new excelb and imported it into osrr.py, an error was reported. So I created a new project in excelb.py and imported it into osrr.py. After that, an error was also reported, as shown in the figure below
I deleted all the imports in test1.py, and then tried them one by one, and found that there was a problem with this string of codes:
from pynput.keyboard import key, controller, but the code I wrote ran directly in vs without any error, so I could run normally.
I found an article on the Internet, which introduced the reasons and solutions (I’m sorry I didn’t know how to blog before, but I can’t find that article after I finally found this function, I’m sorry for the old brother of the original author)
the cause of the problem is the version of pynput. If the latest version 1.7.3 is installed, the above problems will appear when using the package. Use “PIP install pynput” to uninstall the package, and then use the command “PIP install pynput = = 1.6.8” to install version 1.6.8. After the installation is completed, no error will be reported whether the package exe program or running directly in vs.
- (transfer) using Wireshark package capture software to prompt the NPF driver isn’t running solution
- Record pyinnstaller package file execution error modulenotfoundererror: no module named ‘cmath’ solution
- Error occurred when Python installed the pocketsphinx module (package): Command‘ swig.exe “Failed: no such file or directory
- When python installs pocketsphinx module (package), an error is reported: command ‘swig.exe’ failed: No such file or directory
- Idea project prompt: symbol not found or package does not have a solution
- Python packaged *. Exe is running os.popen (cmd)/ subprocess.Popen *. Exe crashes with invalid [winerror 6] handle
- Package python3.1 + PyQt4 into exe
- Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.* signatures do not match the previously
- Visual studio 2017, OpenGL program running prompt glut32.dll missing solution
- Vs under the execution of OpenGL program can run successfully, but do not show things
- Resolve the error raise importerror, str (MSG) + ‘, please install the python TK package’ (valid for personal testing)
- Flutter development: prompt error parsing localfile when running the project: ‘/ users / xxx / Android / APP / SRC / main / androidmanifest. XML’… Solution
- After installing CodeBlocks, run the prompt: tried to run compiler executable ‘C: / / MinGW / bin / mingw32- gcc.exe ‘, but failed!
- Python error: importerror: DLL load failed: unable to find the specified module solution
- What to do when idea Maven package appears could not find artifact xxxxx!
- QT running prompt failed to create OpenGL context for format qsurfaceformat (version 2.0, options qflags() solution)
- Research on Maven management of Java project pom.xml The jar package error is reported, but the project is running normally
- QT + MySQL generates an EXE file and reports an error “driver not loaded”. Solution steps
- Solution of “do not use ‘new’ for side effects” for eslint verification of Vue project
- Running trust error reporting linker ‘link. Exe’ not found on Windows