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

问题描述

我正在用Django开发应用程序.

I am developing an app in Django.

我的应用程序使用winsound模块播放声音.

My app plays a sound using winsound module.

import sys
import winsound

duration = 150  # milliseconds
    freq = 440  # Hz
    winsound.Beep(freq, duration)
    winsound.Beep(freq, duration)
    winsound.Beep(freq, duration)

当我在本地开发时,它就可以正常工作,但是当我将应用程序推送到heroku,然后尝试访问管理部分时,网络返回了错误

It worked fine as soon as I was developing in local, but when I pushed the app to heroku and then tryed to access the admin section, the web returned the error

没有名为"winsound"的模块

No module named 'winsound'

所以我尝试了pip install windsound,但是显然没有命名的模块可供下载.

So I tryed to pip install windsound , but apparently there is no moduled named so available for download.

认为该模块可能已经安装,但使用其他名称,我也尝试过

Thinking that the module was maybe already installed but with another name, I also tried

pip freeze>requirements.txt

并在INSTALLED_APPS中添加了'winsound',但没有任何效果.

and added 'winsound' in INSTALLED_APPS, but nothing worked.

在网络上,我几乎找不到有关winsound模块的信息,而且似乎无法通过python pip安装...有人知道如何解决吗?

On the web I can find little information on winsound module and it appears it is not available to pip install with python... Does anybody knows how to solve it?

推荐答案

问题是heroku的操作系统是linux,而Windows的winsound仅是 ;因此它将不会安装在heroku上.

The problem is that the operating system of heroku is linux, and winsound is only for Windows; So it won't be installed on heroku.

这篇关于/admin处的ModuleNotFoundError没有名为"winsound"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 12:04