[英]PyPDF2 ImportError: cannot import name 'ChainMap' from partially initialized module 'collections' (most likely due to a circular import)
I am using python 3.9
and installed PyPDF2
using pip3 install pypdf2
.我使用
python 3.9
和安装PyPDF2
使用pip3 install pypdf2
。 When I try to import PyPDF2
, I get the following error:当我尝试导入
PyPDF2
,出现以下错误:
"File "C:\Users\mertk\AppData\Local\Programs\Python\Python39\lib\string.py",
line 53, in <module>
from collections import ChainMap as _ChainMap
ImportError: cannot import name 'ChainMap' from partially initialized module
'collections' (most likely due to a circular import)"
C:\Users\mertk\AppData\Local\Programs\Python\Python39\
lib\collections\__init__.py)
How can I fix this?我怎样才能解决这个问题?
Thanks.谢谢。
There is an issue with your installed pypdf2 module.您安装的 pypdf2 模块存在问题。 Uninstall it and reinstall it using the following command
卸载它并使用以下命令重新安装它
pip install pypdf2 --force-reinstall
after that if you're still getting errors make sure you import ChainMap using之后,如果您仍然遇到错误,请确保使用导入 ChainMap
from collections import ChainMap
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.