简体   繁体   English

无法导入媒体播放器模块

[英]Unable to import mediaplayer module

I want to build a simple mp3 player with Qt5 but I've not had much luck importing the required modules. 我想用Qt5构建一个简单的mp3播放器,但导入所需模块的运气并不好。 How do I import Qt5 MediaPlayer? 如何导入Qt5 MediaPlayer? It seems like it is not available in pyqt5. 似乎在pyqt5中不可用。

Here is how I attempted to do the import 这是我尝试导入的方式

from PyQt5.QtMultimedia import QMediaPlayer
from PyQt5 import QtCore

the result 结果

Traceback (most recent call last):
File "C:/Users/ncodes/SkyDrive/Codes/Python/Experiment/py3.py", line 1, in <module>
  from PyQt5.QtMultimedia import QMediaPlayer
ImportError: cannot import name QMediaPlayer

I do not understand why QMediaPlayer cannot be imported because I know Qt5 has QMediaPlayer in QtMultimedia module. 我不明白为什么无法导入QMediaPlayer,因为我知道Qt5在QtMultimedia模块中具有QMediaPlayer。

there is no QMediaPlayer in PyQt5.QtMultimedia of current PyQt5 当前PyQt5的PyQt5.QtMultimedia中没有QMediaPlayer

you can test by the following code 您可以通过以下代码进行测试

>>>import PyQt5.QtMultimedia 
>>>'QMediaPlayer' in [n for n in dir(PyQt5.QtMultimedia)]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM