ModuleNotFoundError:没有名为“ verovio”的模块 [英] ModuleNotFoundError: No module named 'verovio'

查看:93
本文介绍了ModuleNotFoundError:没有名为“ verovio”的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我想在容器中运行我的flask应用程序,但由于第三方模块而卡住了。 (我正在使用PyCharm)

Hi there I would like to run my flask app in a container but I got stucked caused of a third party module. (I am using PyCharm)

这是我的docker文件:

This is my docker file:

FROM python:3-alpine

MAINTAINER foo

COPY app /app

WORKDIR /app

RUN pip install -r requirements.txt

CMD ["python3", "gateway.py"]

我通过以下命令运行容器:

I run the container by this command:

docker run --name mei_converter -p 5000:5000 mei_converter:latest

并接收到以下内容:

ModuleNotFoundError: No module named 'verovio'

我已经修复了依赖项为了在我的本地计算机上运行它

I already fixed the dependencies in order to run it on my local machine

Terminal: python3 gateway.py

['/usr/local/lib/python3.7/site-packages', 
'/Users/max/PycharmProjects/flaskmicroservice/app', 
'/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python37.zip', 
'/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7', 
'/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib- 
dynload', '/Users/max/Library/Python/3.7/lib/python/site-packages', 
'/usr/local/lib/python3.7/site-packages', '/usr/local/lib/python3.7/site-packages/verovio- 
2.0.0-py3.7-macosx-10.13-x86_64.egg']
* Serving Flask app "gateway" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)

效果很好

我还检查了PyCharm中的项目解释器,并找到了已安装的软件包。

I also checked the project interpreter in PyCharm and found the package as installed.

也许有关此第三方软件包的某些信息可能会有所帮助:
这是这些人 https://www.verovio.org/python.xhtml
而不是 native python(必须使用SWIG)
我来自Java世界,实际上对python零经验。我正在将该烧瓶应用程序用作我的Spring Boot应用程序的微服务。
我将不胜感激!

Maybe some information about this third party package could help: It is a converter for music-encoding from these guys https://www.verovio.org/python.xhtml and not "native python" (SWIG is necessary) By the way.. I come from the java world and have in fact zero experience with python. I am using this flask app as an microservice for my spring boot app. I would be grateful for any help!

推荐答案

您需要在容器中执行的操作与在容器中执行的操作相同本地主机。也就是说,您需要向Dockerfile添加步骤以编译verovio并在容器中使用它。

You need to do in the container the same you did in your local host. That is, you need to add steps to the Dockerfile to compile verovio and use it in the container.

这篇关于ModuleNotFoundError:没有名为“ verovio”的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆