我正在尝试使用 python 库 trackpy 来追踪一些蜡颗粒。当我导入必要的库时,在我的代码开头,
import numpy as np
import pandas as pd
from pandas import DataFrame, Series # for convenience
import pims
import trackpy as tp
我收到以下属性错误:
AttributeError: module 'inspect' has no attribute 'getmoduleinfo'
这发生在 trackpy 库中文件 try_numba.py 的这段代码的第 8 行。
def __init__(self, func, fallback=None, autojit_kw=None):
self.func = func
# This covers a Python 2/3 change not covered by six
try:
self.func_name = func.__name__
except AttributeError:
self.func_name = func.func_name
module_name = inspect.getmoduleinfo(
six.get_function_globals(func)['__file__']).name
module_name = '.'.join(['trackpy', module_name])
self.module_name = module_name
self.autojit_kw = autojit_kw
if fallback is not None:
self.ordinary = fallback
else:
self.ordinary = func
有谁知道发生了什么?我的大部分代码都依赖于这个库。