Background:
The project is built based on virtual environment, and the third-party packages are actually installed in:
E:\PyProject\py_basic\Lib\site-packages is not the same directory as Python installation directory
Question:
Both pycham and CMD can operate normally, but Jenkins build error:
C:\Users\86158\.jenkins\workspace\ihrm_code>python run_suite.py
Traceback (most recent call last):
File "run_suite.py", line 3, in <module>
from htmltestreport import HTMLTestReport
ModuleNotFoundError: No module named 'htmltestreport'
Solution:
Add environment variables to Jenkins. This problem is usually caused by the configuration of environment variables