gpt4 book ai didi

Python 坏了,AttributeError : 'module' object has no attribute 'python_version'

转载 作者:可可西里 更新时间:2023-11-01 09:39:14 24 4
gpt4 key购买 nike

我在 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 时,我得到了同样的结果。奇怪的是,当我尝试运行 import pandas as pd 而不是 import pandas 时,我收到此错误:

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 3.8 删除了一些东西。我通过使用 curl
安装 pip 解决了我的 pip 问题(特别是 pip install)
对我有用的是:
cd ~/Downloads
下载 get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
然后用 python 3.8 运行它:
python3.8 get-pip.py

帮我解决了。

来源:https://pip.pypa.io/en/stable/installing/

关于Python 坏了,AttributeError : 'module' object has no attribute 'python_version' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30123498/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com