所以这是一个奇怪的......我承认,我安装了我自己的模块,其中包含多种
- python setup.py 安装
- python setup.py 开发
- 点安装。
- 点安装-e。
但是在使用“pip卸载”并手动删除任何剩余的鸡蛋或鸡蛋链接,甚至*.pth文件中的条目后,我无法确定导入模块(planet4)的剩余能力的来源。
我尝试了明显的:planet4.__file__
但那是空的:
In [12]: planet4.__file__
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-12-09c196cdfffe> in <module>()
----> 1 planet4.__file__
AttributeError: module 'planet4' has no attribute '__file__'
Python 仍然认为这是一个模块:
In [16]: type(planet4)
Out[16]: module
当我尝试使用pkg_resources
一些隐藏文件路径时,我得到了最奇怪的错误,即使是谷歌也只见过几次,至少与删除包有关:
In [10]: import pkg_resources as pr
In [11]: pr.resource_exists('planet4', 'data')
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
<ipython-input-11-3ac559fe861b> in <module>()
----> 1 pr.resource_exists('planet4', 'data')
/Users/klay6683/miniconda3/envs/py35/lib/python3.5/site-packages/setuptools-19.6.2-py3.5.egg/pkg_resources/__init__.py in resource_exists(self, package_or_requirement, resource_name)
1137 def resource_exists(self, package_or_requirement, resource_name):
1138 """Does the named resource exist?"""
-> 1139 return get_provider(package_or_requirement).has_resource(resource_name)
1140
1141 def resource_isdir(self, package_or_requirement, resource_name):
/Users/klay6683/miniconda3/envs/py35/lib/python3.5/site-packages/setuptools-19.6.2-py3.5.egg/pkg_resources/__init__.py in has_resource(self, resource_name)
1603
1604 def has_resource(self, resource_name):
-> 1605 return self._has(self._fn(self.module_path, resource_name))
1606
1607 def has_metadata(self, name):
/Users/klay6683/miniconda3/envs/py35/lib/python3.5/site-packages/setuptools-19.6.2-py3.5.egg/pkg_resources/__init__.py in _has(self, path)
1658 def _has(self, path):
1659 raise NotImplementedError(
-> 1660 "Can't perform this operation for unregistered loader type"
1661 )
1662
NotImplementedError: Can't perform this operation for unregistered loader type
有人知道我可以尝试什么吗?