Python broke, AttributeError: 'module' object has no attribute 'python_version'

I am running 2.7 on Windows. I had no problem until yesterday when I tried to run multiple jobs using the library multiprocessing

, got a bunch of memory errors and everything crashed.

This is what happens when I try to run 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'

      

I get the same thing when I try import pandas

from the python shell. Oddly enough, when instead of importing pandas, I try to run import pandas as pd

, I get this error:

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

      

Any idea how I can fix this without completely reinstalling Python and all my libraries?

+3


source to share


1 answer


You can find platform.pyc in your python folder and tag it. Ok, you will see that it worked (because it will have a new platform.pyc ).



-1


source







All Articles