我在Windows上运行2.7。 直到昨天,我还没有遇到任何问题,当我试图使用multiprocessing
库运行一些工作,有一堆内存错误,一切都崩溃了。
这是我尝试运行pip
时发生的情况:
Traceback (most recent call last): File "C:\Python27\lib\runpy.py", line 162, in _run_module_as_ma "__main__", fname, loader, pkg_name) File "C:\Python27\lib\runpy.py", line 72, in _run_code exec code in run_globals File "C:\Python27\Scripts\pip.exe\__main__.py", line 5, in <mod File "C:\Python27\lib\site-packages\pip\__init__.py", line 13, from pip.utils import get_installed_distributions, get_prog File "C:\Python27\lib\site-packages\pip\utils\__init__.py", lin e> from pip._vendor import pkg_resources, six File "C:\Python27\lib\site-packages\pip\_vendor\__init__.py", l _module __import__(name) File "C:\Python27\lib\site-packages\pip\_vendor\pkg_resources\_ ne 1316, in <module> class MarkerEvaluation(object): File "C:\Python27\lib\site-packages\pip\_vendor\pkg_resources\_ ne 1320, in MarkerEvaluation 'python_full_version': platform.python_version, AttributeError: 'module' object has no attribute 'python_version'
当我尝试从python shell import pandas
时,我得到了同样的结果。 奇怪的是,当代替导入pandas我试图运行import pandas as pd
,我得到这个错误:
In [3]: import pandas as pd cannot import name hashtable ------------------------------------------ ImportError <ipython-input-3-af55e7023913> in <module> ----> 1 import pandas as pd C:\Python27\lib\site-packages\pandas\__ini 5 6 try: ----> 7 from . import hashtable, tslib 8 except Exception: # pragma: no co 9 import sys ImportError: cannot import name hashtable
任何想法如何解决这个问题,而不是完全重新安装Python和我所有的库?
你可以在python文件夹中找到platform.pyc ,然后点击它。 好的,你会看到它的工作(因为它将有一个新的platform.pyc权利)。