scene :
stay PyCharm And terminal operation .py All files are running normally , No report error , stay Jenkins Build Python Report errors
Causes and Solutions :
One 、 On the Internet, there are arguments about right and wrong root Permission to install xlrd plug-in unit , Permission error caused by Jenkins function python Prompt when import error_u012928160 The blog of -CSDN Blog
Two 、 My case is the second case , The plug-in directory I installed and the project are no longer in the same directory
That is, execute... On the command line .py The package cannot be found when the file is loaded because we did not save the project path , It can be done by sys.path.append() Save your project path , It's going to work
solve :
The one who reported the error py In file , take xlrd The location of the plug-in package is saved , Then it can run normally
python Command line execution .py File tips ModuleNotFoundError: No module named 'XXX' resolvent _jianglianye21 The blog of -CSDN Blog