openpyxl pip 安装失败

维尼什 TP

我试图通过 pip 安装 openpyxl,得到以下错误。我该如何解决这个问题。

C:\Users\User>python -m pip install --user openpyxl==3.0.3
Collecting openpyxl==3.0.3
  Using cached openpyxl-3.0.3.tar.gz (172 kB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Program Files\Python36\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-4ji7fq22\\openpyxl\\setup.py'"'"'; __file__='"'"'C:\\Users\\User\\AppData\\Local\\Temp\\pip-install-4ji7fq22\\openpyxl\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\User\AppData\Local\Temp\pip-install-4ji7fq22\openpyxl\pip-egg-info'
         cwd: C:\Users\User\AppData\Local\Temp\pip-install-4ji7fq22\openpyxl\
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\User\AppData\Roaming\Python\Python36\site-packages\setuptools\__init__.py", line 12, in <module>
        from setuptools.extension import Extension
      File "C:\Users\User\AppData\Roaming\Python\Python36\site-packages\setuptools\extension.py", line 7, in <module>
        from setuptools.dist import _get_unpatched
      File "C:\Users\User\AppData\Roaming\Python\Python36\site-packages\setuptools\dist.py", line 16, in <module>
        import pkg_resources
      File "C:\Users\User\AppData\Roaming\Python\Python36\site-packages\pkg_resources.py", line 1479, in <module>
        register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
    AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
OD1995

看起来这个回溯的重要部分是:

AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

使用这个问题,尝试:

python3 -m ensurepip --upgrade

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章