【问题标题】:Pip3 can't install "empy" for python 3.8.6 (No matching distribution found for empy)Pip3 无法为 python 3.8.6 安装“empy”(没有找到与 empy 匹配的发行版)
【发布时间】:2022-01-26 22:20:18
【问题描述】:

我试图在我的 ubuntu 18.04 电脑上使用 python 3.8.6 创建的虚拟环境中使用 pip3 install empy 命令安装 empy,但出现以下主要错误:

ERROR: Could not find a version that satisfies the requirement empy (from versions: 3.3.2, 3.3.4)
ERROR: No matching distribution found for empy 

我还使用sudo apt-get install libffi-dev 安装了“libffi-dev”以防止出现错误ModuleNotFoundError: No module named '_ctypes',但错误仍然存​​在并且保持不变。

终端中的完全错误:

(py3venv) expert-bot@expert-nx:~/python3_ws$ pip3 install empy
Collecting empy
  Using cached empy-3.3.4.tar.gz (62 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/expert-bot/python3_ws/py3venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-04mt1wt_/empy_f5b8490ded264bce82e92de860ffaccf/setup.py'"'"'; file__='"'"'/tmp/pip-install-04mt1wt_/empy_f5b8490ded264bce82e92de860ffaccf/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-vx6cf784
       cwd: /tmp/pip-install-04mt1wt_/empy_f5b8490ded264bce82e92de860ffaccf/
  Complete output (13 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
      from setuptools.dist import Distribution
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/_virtualenv.py", line 89, in exec_module
      old(module)
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/dist.py", line 37, in <module>
      from setuptools import windows_support
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
      import ctypes
    File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
      from _ctypes import Union, Structure, Array
  ModuleNotFoundError: No module named '_ctypes'
  ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/3b/95/88ed47cb7da88569a78b7d6fb9420298df7e99997810c844a924d96d3c08/empy-3.3.4.tar.gz#sha256=73ac49785b601479df4ea18a7c79bc1304a8a7c34c02b9472cf1206ae88f01b3 (from https://pypi.org/simple/empy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
  Using cached empy-3.3.2.tar.gz (138 kB)
  Preparing metadata (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/expert-bot/python3_ws/py3venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-04mt1wt_/empy_104fd15b7f9e408eb4a702d46fe5de03/setup.py'"'"'; file__='"'"'/tmp/pip-install-04mt1wt_/empy_104fd15b7f9e408eb4a702d46fe5de03/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-_fwmqok0
       cwd: /tmp/pip-install-04mt1wt_/empy_104fd15b7f9e408eb4a702d46fe5de03/
  Complete output (13 lines):
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
      from setuptools.dist import Distribution
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/_virtualenv.py", line 89, in exec_module
      old(module)
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/dist.py", line 37, in <module>
      from setuptools import windows_support
    File "/home/expert-bot/python3_ws/py3venv/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
      import ctypes
    File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
      from _ctypes import Union, Structure, Array
  ModuleNotFoundError: No module named '_ctypes'
  ----------------------------------------
WARNING: Discarding
https://files.pythonhosted.org/packages/b7/56/72a285d257c7791616960493a04f14c05ca1bf7a83dd208485cf991563bd/empy-3.3.2.tar.gz#sha256=99f016af2770c48ab57a65df7aae251360dc69a1514c15851458a71d4ddfea9c (from https://pypi.org/simple/empy/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement empy (from versions: 3.3.2, 3.3.4)
ERROR: No matching distribution found for empy 

这个问题有什么可能的解决方案?

【问题讨论】:

    标签: python-3.x pip ubuntu-18.04 python-3.8 empy


    【解决方案1】:

    看起来您的 Python 缺少 _ctypes 模块,但我认为 empy 将在此之后安装。我相信_ctypes(依赖于libffi)是在安装Python 本身时内置到Python 中的。如果您自己安装了 Python 并且 然后 安装了 libffi,请尝试重新安装 Python。它甚至会在终端中写入它构建的“可选”模块,_ctypes 应该在其中。

    哦,如果 Python configure 脚本很难找到 libffi,请提供 --with-system-ffi 并将 libffi include 目录添加到 CPPFLAGS,并将 libffi lib 目录添加到 LDFLAGSLD_LIBRARY_PATH,例如

    export CPPFLAGS="-I/path/to/libffi/include ${CPPFLAGS}"
    export LDFLAGS="-L/path/to/libffi/lib -Wl,-rpath=/path/to/libffi/lib ${LDFLAGS}"
    export LD_LIBRARY_PATH="/path/to/libffi/lib:${LD_LIBRARY_PATH}"
     ./configure --with-system-ffi ...
    

    【讨论】:

    • 我降级了我的 python 版本(3.6.9,这是系统默认值),我可以毫无问题地安装在那个版本上。看起来当我尝试从源代码安装其他版本的 python3 时,就会出现这种类型的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-05-25
    • 2019-12-26
    • 1970-01-01
    • 1970-01-01
    • 2014-03-26
    • 2021-08-02
    • 2019-10-30
    相关资源
    最近更新 更多