我有一个具有以下结构的python包:
using System.Linq;
public int GetHighestValue(Dictionary<MyTypes, OtherType> obj)
{
return obj.Count > 0 ? obj.Max(t => t.Key.Age) : 0; //could also return -1
}
init .py具有:
mypackage/
|______ bar
|______ __iniit__.py
install.py
在install.py中,当我这样做
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
我不断得到:
from mypackage.bar import config
我尝试在导入后执行Traceback (most recent call last):
File "/tmp/tmp0wXmB4/install.py", line 366, in <module>
from mypackage.bar import config
File "/usr/local/lib/python2.7/site-packages/mypackage/__init__.py", line 6, in <module>
from ._version import get_versions
,但是它不起作用。可能会缺少什么指针吗?