【发布时间】:2021-11-21 16:35:06
【问题描述】:
我编写了一个成功构建的 docker 映像文件。
但是,当我使用该图像运行容器时,它会产生以下 numpy 错误并退出。
知道如何纠正这种情况吗?
错误:
Traceback (most recent call last):
File "/opt/venv/lib/python3.9/site-packages/numpy/core/__init__.py", line 22, in <module>
from . import multiarray
File "/opt/venv/lib/python3.9/site-packages/numpy/core/multiarray.py", line 12, in <module>
from . import overrides
File "/opt/venv/lib/python3.9/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /opt/venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-x86_64-linux-gnu.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/app/./MetReTrim", line 14, in <module>
import matplotlib.pyplot as plt
File "/opt/venv/lib/python3.9/site-packages/matplotlib/__init__.py", line 107, in <module>
from . import _api, cbook, docstring, rcsetup
File "/opt/venv/lib/python3.9/site-packages/matplotlib/cbook/__init__.py", line 28, in <module>
import numpy as np
File "/opt/venv/lib/python3.9/site-packages/numpy/__init__.py", line 150, in <module>
from . import core
File "/opt/venv/lib/python3.9/site-packages/numpy/core/__init__.py", line 48, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "/opt/venv/bin/python"
* The NumPy version is: "1.21.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /opt/venv/lib/python3.9/site-packages/numpy/core/_multiarray_umath.cpython-39-x86_64-linux-gnu.so)
【问题讨论】:
标签: python-3.x linux docker numpy python-venv