Tencent / CodeAnalysis

Static Code Analysis - 静态代码分析
https://tencent.github.io/CodeAnalysis/
Other
1.66k stars 286 forks source link

ModuleNotFoundError: No module named 'task.scmmgr' #59

Closed AlexBdd closed 2 years ago

AlexBdd commented 2 years ago

执行:python3 codepuppy.py localscan报如下错误!

[root@idss-centos-7 client]# python3 -V Python 3.8.11 [root@idss-centos-7 client]# [root@centos-7 client]# python3 codepuppy.py localscan Traceback (most recent call last): File "codepuppy.py", line 22, in from tool.util.pythontool import PythonTool File "/opt/Tencent/CodeAnalysis/client/tool/util/pythontool.py", line 15, in from task.scmmgr import SCMMgr ModuleNotFoundError: No module named 'task.scmmgr' [root@centos-7 client]# [root@centos-7 client]#

bensonhome commented 2 years ago

这里的python3要求版本是3.7,麻烦切换版本再试试

AlexBdd commented 2 years ago

换了3.7.9的环境,执行扫描,又报如下错误:

[root@localhost client]# python3 -V Python 3.7.9 [root@localhost client]# [root@localhost client]# python3 codepuppy.py localscan Traceback (most recent call last): File "codepuppy.py", line 22, in from tool.util.pythontool import PythonTool File "/opt/CodeAnalysis/client/tool/util/pythontool.py", line 15, in from task.scmmgr import SCMMgr ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory [root@localhost client]# [root@localhost client]#

AlexBdd commented 2 years ago

换了3.7.9的环境,执行扫描,又报如下错误:

[root@localhost client]# python3 -V Python 3.7.9 [root@localhost client]# [root@localhost client]# python3 codepuppy.py localscan Traceback (most recent call last): File "codepuppy.py", line 22, in from tool.util.pythontool import PythonTool File "/opt/CodeAnalysis/client/tool/util/pythontool.py", line 15, in from task.scmmgr import SCMMgr ImportError: libpython3.7m.so.1.0: cannot open shared object file: No such file or directory [root@localhost client]# [root@localhost client]#

重新安装python3, 执行配置文件时加上--enable-shared后解决 ./configure --prefix=/opt/python3 --enable-shared

AlexBdd commented 2 years ago

还需要配置好Python库。

进入:/etc/ld.so.conf.d/

$ cd /etc/ld.so.conf.d/

新建:python3.conf

$ vim python3.conf

输入如下一行内容后,保存,退出编辑 /opt/python3/lib

执行ldconfig刷新

$ ldconfig