在使用 M1 在 macos 上构建图像时,出现以下错误:
Collecting python-Levenshtein==0.12.2
Using cached python-Levenshtein-0.12.2.tar.gz (50 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.6/site-packages (from python-Levenshtein==0.12.2) (33.1.1)
Using legacy 'setup.py install' for python-Levenshtein, since package 'wheel' is not installed.
Installing collected packages: python-Levenshtein
Running setup.py install for python-Levenshtein ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z9yhh5ds/python-levenshtein_e99c5f8b2a70415d998d3534a8b15e14/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z9yhh5ds/python-levenshtein_e99c5f8b2a70415d998d3534a8b15e14/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'"'"'))' install --record /tmp/pip-record-60fgubma/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/python-Levenshtein
cwd: /tmp/pip-install-z9yhh5ds/python-levenshtein_e99c5f8b2a70415d998d3534a8b15e14/
Complete output (31 lines):
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/Levenshtein
copying Levenshtein/StringMatcher.py -> build/lib.linux-x86_64-3.6/Levenshtein
copying Levenshtein/__init__.py -> build/lib.linux-x86_64-3.6/Levenshtein
running egg_info
writing python_Levenshtein.egg-info/PKG-INFO
writing dependency_links to python_Levenshtein.egg-info/dependency_links.txt
writing entry points to python_Levenshtein.egg-info/entry_points.txt
writing namespace_packages to python_Levenshtein.egg-info/namespace_packages.txt
writing requirements to python_Levenshtein.egg-info/requires.txt
writing top-level names to python_Levenshtein.egg-info/top_level.txt
reading manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files matching '*pyc' found anywhere in distribution
warning: no previously-included files matching '*so' found anywhere in distribution
warning: no previously-included files matching '.project' found anywhere in distribution
warning: no previously-included files matching '.pydevproject' found anywhere in distribution
writing manifest file 'python_Levenshtein.egg-info/SOURCES.txt'
copying Levenshtein/_levenshtein.c -> build/lib.linux-x86_64-3.6/Levenshtein
copying Levenshtein/_levenshtein.h -> build/lib.linux-x86_64-3.6/Levenshtein
running build_ext
building 'Levenshtein._levenshtein' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/Levenshtein
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python3.6m -c Levenshtein/_levenshtein.c -o build/temp.linux-x86_64-3.6/Levenshtein/_levenshtein.o
gcc: error: missing argument to ‘-march=’
error: command 'gcc' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-z9yhh5ds/python-levenshtein_e99c5f8b2a70415d998d3534a8b15e14/setup.py'"'"'; __file__='"'"'/tmp/pip-install-z9yhh5ds/python-levenshtein_e99c5f8b2a70415d998d3534a8b15e14/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'"'"'))' install --record /tmp/pip-record-60fgubma/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.6m/python-Levenshtein Check the logs for full command output.
我的 Dockerfile 是:
FROM ***:21.06.22.1038
# install related packages
COPY target/requirements.txt /root/requirements.txt
RUN pip3 install -r /root/requirements.txt -i https://pypi.douban.com/simple/
我的 requirements.txt 是:
pymysql
requests==2.21.0
xlrd==1.2.0
tornado==5.1.1
pypinyin==0.35.3
python-Levenshtein==0.12.2
thrift==0.13.0
jieba==0.42.1
Cython==0.28.5
elasticsearch==7.13.1
scikit-learn==0.18.2
ConcurrentLogHandler==0.9.1
tormysql==0.4.2
truepy==2.0.4
redis==3.0.1
redis-py-cluster==2.0.0
我的基础镜像版本是python3.6.8,如果我从requirements.txt中删除python-Levenshtein==0.12.2,就会成功。
我已经安装:
wget aclocal automake autoconf make gcc gcc-c++ python3-devel mysql-devel bzip2 libffi-devel openssl-devel epel-release python3-pip python3-setuptools python3-libs
在我的基本图像中。