我试图在我的ubuntu18.04PC上使用python3.8.6创建的虚拟环境中安装带有pip3 install empy
命令的pip3 install 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”,以防止错误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
解决这一问题的可能办法是什么?
发布于 2022-01-26 22:50:37
看起来您的Python缺少了_ctypes
模块,但我认为empy
会在此之后安装。我相信_ctypes
(它依赖于libffi)在安装Python本身时就已经内置到Python中了。如果您自己安装了Python,然后安装了libffi,那么尝试重新安装Python。它甚至会在终端中写出它构建的“可选”模块,在这里,_ctypes
应该是其中之一。
哦,如果Python脚本很难找到libffi,那么提供configure
并将libffi include
目录添加到CPPFLAGS
,并将libffi lib
目录添加到LDFLAGS
和LD_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 ...
https://stackoverflow.com/questions/70870990
复制相似问题