install docxtpl AttributeError: module ‘importlib._bootstrap‘ has no attribute ‘SourceFileLoad‘问题解决

apple@bobo src % pip3 install docxtpl
Collecting docxtpl
  Using cached docxtpl-0.18.0-py2.py3-none-any.whl.metadata (8.9 kB)
Requirement already satisfied: python-docx>=1.1.1 in /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages (from docxtpl) (1.1.2)
Collecting docxcompose (from docxtpl)
  Using cached docxcompose-1.4.0.tar.gz (20 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [12 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 14, in <module>
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/__init__.py", line 12, in <module>
          from setuptools.extension import Extension
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/extension.py", line 7, in <module>
          from setuptools.dist import _get_unpatched
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/setuptools/dist.py", line 16, in <module>
          import pkg_resources
        File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pkg_resources.py", line 1479, in <module>
          register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
      AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
 

尝试更新 pip 和 setuptools 到最新版本,这有时可以解决兼容性问题。

pip3 install --upgrade pip setuptools

pip3 install docxtpl 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

徒步@天涯

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值