首页 > 解决方案 > Openpyxl Pip 安装错误:命令出错

问题描述

尝试安装 openpyxl 时,我继续收到以下错误:

pip install openpyxl
Collecting openpyxl
  Using cached openpyxl-3.0.3.tar.gz (172 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/bigdata/scripts/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-eztesmv9/openpyxl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-eztesmv9/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 /tmp/pip-install-eztesmv9/openpyxl/pip-egg-info
         cwd: /tmp/pip-install-eztesmv9/openpyxl/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/bigdata/scripts/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
        from setuptools.dist import Distribution, Feature
      File "/home/bigdata/scripts/lib/python3.8/site-packages/setuptools/dist.py", line 36, in <module>
        from setuptools import windows_support
      File "/home/bigdata/scripts/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
        import ctypes
      File "/home/bigdata/lib/python3.8/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ModuleNotFoundError: No module named '_ctypes'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

根据其他帖子,我已经尝试过以下命令:

python3 -m ensurepip --upgrade
pip install --upgrade setuptools
pip install -U pip

随着他们每个人的回归:

Requirement already up-to-date: setuptools in /home/bigdata/scripts/lib/python3.8/site-packages (45.1.0)

我错过了什么吗?我们刚刚将我们的帐户迁移到 A2 Hosting VPS 服务器,我对大部分设置都不熟悉。任何帮助深表感谢。

标签: pythonpython-3.xpipopenpyxl

解决方案


我可以通过重新安装 python 来解决这个问题,遵循来自 phd 的线索,我可能有一个损坏的安装。


推荐阅读