[Solved] Jenkins Run python Project Error: “ModuleNotFoundError: No module named ‘xxx‘”

At runtime, jekins will take all folder paths of the current project as the search path of the package, while the command line only searches the current path by default.

Error message: modulenotfounderror: no module named ‘xxx’#

Solution:

Configure environment variables in jekins: system management → system settings (global settings and paths)

1.Global properties check Environment variables
2.Add new key-value pairs
Key:PYTHONPATH
Value:/var/lib/jenkins/workspace/project name

Similar Posts: