1
不知何故,我最终安装了2个不同的模块,名为'谷歌'。其中一个出现在python中的site_packages文件夹中,以及在PYTHONPATH中提供的我自定义路径中的一个。 我想摆脱site_packages中的那个。所以我删除了该文件夹(根据其他SO答案)。但现在,我面对这种怪异的情况下,它仍然加载错误上在启动Python模块没有正确删除
>>> import google; google.__path__
['/Library/Python/2.7/site-packages/google']
>>> google.__file__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute '__file__'
>>> reload(google)
<module 'google' from '/custom_path/google-cloud-sdk/platform/google_appengine/google/__init__.pyc'>
>>> google.__path__
['/custom_path/google-cloud-sdk/platform/google_appengine/google'
>>> google.__file__
'/custom_path/google-cloud-sdk/platform/google_appengine/google/__init__.pyc'
因此,基本上,第一次它仍然加载旧模块(在它没有文件),并重新加载,它给正确的。
我的问题是如何完全删除旧的,因为总是重新加载模块是不可行的。