Pycharm 可以运行的脚本,为什么到Jenkins 里面就失败了?
Jenkins 里面的 错误日志日下:
C:\Anaconda3\lib\site-packages\numpy_init_.py:140: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "main.py", line 9, in <module>
from common_utils import common_utils
File "C:\PycharmProjects\APITest(V12.1)\common_utils\common_utils.py", line 14, in <module>
import pymssql
ModuleNotFoundError: No module named 'pymssql'
=========================================================================
pymssql 这个包已经安装。
请问这个问题谁遇到过,而且已解决了的,有吗?
我试了网上的方法 在每个py文件最前面添加下面的语句,结果还是失败的。
import sys
sys.path.append(r“C:\PycharmProjects\APITest(V12.1)”)
哈哈,自己解决了。
解决方法如下:
需要在Jenkins 里面切换成代码使用的虚拟运行环境,代码如下:
cd "C:\Anaconda3\envs\Py38_Django"
activate Py38_Django && python "C:\PycharmProjects\APITest(V12.1)\main.py"