gpt4 book ai didi

Python:没有名为 contextlib 的模块?

转载 作者:太空狗 更新时间:2023-10-29 22:02:04 27 4
gpt4 key购买 nike

有谁知道我在哪里可以找到这个 python 模块“contextlib”?

root@overo:~# python                                                            
Python 2.6.6 (r266:84292, Mar 9 2011, 10:05:36)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import contextlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named contextlib

我没有亲自编译python。我只是在这个烂摊子。它在基于 ARM 的 CPU 上运行,因此可能为了节省空间而省略了一些内容。

我运行了 find/| grep contextlib 没有任何结果。

我可以从某个地方下载这个模块,然后把它放在/usr/lib/python2.6 中吗?那行得通吗?

最佳答案

我以不同的方式遇到了这个错误。

我在 Windows 10 上使用 32 位版本的 Python 3.6.5 创建了一个 pipenv 虚拟环境。然后我意识到我需要 64 位版本。卸载 32 位,安装 64 位,然后尝试返回到我现有的虚拟环境。之前创建的环境现在以奇怪的方式被破坏并给了我这个错误。

我通过删除旧的 pipenv pipenv --rm 并使用新安装的 python 版本创建一个新的来解决这个问题。

关于Python:没有名为 contextlib 的模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5520515/

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