我想使用pycvss,所以我通过pip安装了它。
但是,实例化Cvss()类失败:
>>> import pycvss
>>> c = pycvss.Cvss()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Cvss'在检查模块时,它看起来确实是空的:
>>> dir(pycvss)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__']但是,当我检查python在哪里查找模块时:
>>> print(pycvss.__file__)
/usr/local/python-2.7.8/lib/python2.7/site-packages/pycvss/__init__.pyc看起来是这样,
/usr/local/python-2.7.8/lib/python2.7/site-packages/pycvss/pycvss.py
确实定义了` `Cvss():
(...)
class Cvss(object):
"""Common Vulnerability Scoring System.
Use this class to set base, temporal and environmental vectors and
compute scores.
Cf module level documentation for sample usage.
"""
_BASE_VECTOR = (AV, AC, Au, C, I, A)
(...)我肯定遗漏了一些显而易见的东西,但我越看越少(其他模块都很好,包括pip安装的模块,比如requests)。
发布于 2014-11-07 12:00:36
发布于 2014-11-07 11:59:46
pycvss是一个包,您需要将它作为
import pycvss.pycvss
c = pycvss.pycvss.Cvss()或者去做:-
from pycvss import pycvss
c = pycvss.Cvss()https://stackoverflow.com/questions/26800710
复制相似问题