我尝试了不同版本的 python 和 numpy,但似乎没有任何效果。还尝试在控制台中显示 'numpy.core._multiarray_umath',它适用于 numpy 1.19.3、1.19.4 和 1.19.5 版本。
docker run 命令后,显示如下错误:
(py36) C:\ANPR\Video_Tolling>docker run -p 5000:5000 dockerpython
Traceback (most recent call last):
File "/numpy/core/__init__.py", line 22, in <module>
from . import multiarray
File "/numpy/core/multiarray.py", line 12, in <module>
from . import overrides
File "/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 1, in <module>
import video_toll
File "/video_toll.py", line 2, in <module>
from calculations import Calculations
File "/calculations.py", line 3, in <module>
import numpy as np
File "/numpy/__init__.py", line 140, in <module>
from . import core
File "/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.8 from "/usr/local/bin/python"
* The NumPy version is: "1.19.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
Requirements.txt
具有以下要求:
Flask==1.1.1
requests~=2.25.1
opencv-python~=4.5.1.48
imutils~=0.5.3
numpy~=1.19.4
pytesseract~=0.3.7
pyzbar~=0.1.8
pandas~=1.2.1
pymongo~=3.11.2
publicip~=1.0.1
dnspython
我的 Conda 环境具有:
numpy version 1.19.4
python version 3.8
Docker 文件:
FROM python:3.8.0-buster
# Make a directory for our application
WORKDIR ./
# Install dependencies
COPY requirements.txt .
RUN pip install -r requirements.txt
# Copy our source code
COPY /app .
# Run the application
CMD ["python", "main.py"]