绑定python-vlc时出现问题

时间:2018-11-17 21:31:09

标签: python python-3.6 vlc

使用pip install python-vlc安装了vlc,但是我收到此错误 我所有其他导入工作正常,我的计算机上也有VLC,但仍然出现此错误。我正在使用python 3.6。这是我的代码,如果您可以帮助的话,将不胜感激。

from pytube import YouTube
import vlc
import urllib.request
from bs4 import BeautifulSoup
import pafy


temporary = "play gangnam style"

num1 = temporary.index("play")
str1 = temporary[5:]
print(str1)
textToSearch = str1 
query = urllib.parse.quote(textToSearch)
url = "https://www.youtube.com/results?search_query=" + query
response = urllib.request.urlopen(url)
html = response.read()
soup = BeautifulSoup(html, 'html.parser')
for vid in soup.findAll(attrs={'class':'yt-uix-tile-link'}):
    getURL = 'https://www.youtube.com' + vid['href']
    print(getURL)
    url = str(getURL)
    video = pafy.new(url)
    best = video.getbest()
    playurl = best.url
    print(playurl)
    Instance = vlc.Instance()
    player = Instance.media_player_new()
    Media = Instance.media_new(playurl)
    Media.get_mrl()
    player.set_media(Media)
    player.play()
    break

输出:

The interactive Python process has exited.
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\testt.py", line 2, in <module>
    import vlc
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\vlc\__init__.py", line 4, in <module>
    from vlc.helper import tell
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\vlc\helper.py", line 4, in <module>
    import applescript
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python36\lib\site-packages\applescript\__init__.py", line 6, in <module>
    import temp
ModuleNotFoundError: No module named 'temp'

0 个答案:

没有答案