我正在尝试导入底图,并在下面收到错误。我查看了stackoverflow上的问题,并尝试了这里提供的建议:
Why do I get "UserWarning: Module dap was already imported from None ..."
当我尝试使用控制台导入时,它工作正常,但在ipython中导入似乎有问题
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-8-696228d030c9> in <module>()
----> 1 import mpl_toolkits.basemap
/usr/lib/pymodules/python2.7/mpl_toolkits/__init__.py in <module>()
1 try:
----> 2 __import__('pkg_resources').declare_namespace(__name__)
3 except ImportError:
4 pass # must not have setuptools
/usr/lib/python2.7/dist-packages/pkg_resources.py in <module>()
2823 # all distributions added to the working set in the future (e.g. by
2824 # calling ``require()``) will get activated as well.
-> 2825 add_activation_listener(lambda dist: dist.activate())
2826 working_set.entries=[]; map(working_set.add_entry,sys.path) # match order
2827
/usr/lib/python2.7/dist-packages/pkg_resources.py in subscribe(self, callback)
708 self.callbacks.append(callback)
709 for dist in self:
--> 710 callback(dist)
711
712
/usr/lib/python2.7/dist-packages/pkg_resources.py in <lambda>(dist)
2823 # all distributions added to the working set in the future (e.g. by
2824 # calling ``require()``) will get activated as well.
-> 2825 add_activation_listener(lambda dist: dist.activate())
2826 working_set.entries=[]; map(working_set.add_entry,sys.path) # match order
2827
/usr/lib/python2.7/dist-packages/pkg_resources.py in activate(self, path)
2258 if path is sys.path:
2259 fixup_namespace_packages(self.location)
-> 2260 map(declare_namespace, self._get_metadata('namespace_packages.txt'))
2261
2262
/usr/lib/python2.7/dist-packages/pkg_resources.py in declare_namespace(packageName)
1834 __import__(parent)
1835 try:
-> 1836 path = sys.modules[parent].__path__
1837 except AttributeError:
1838 raise TypeError("Not a package:", parent)
KeyError: 'dap'
有关如何在ipython中导入的任何建议。