首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >没有名为Appkit的模块。如果我试图将它安装在pycharm中,它会不停地说:"ERROR:命令出错,退出状态为1:“

没有名为Appkit的模块。如果我试图将它安装在pycharm中,它会不停地说:"ERROR:命令出错,退出状态为1:“
EN

Stack Overflow用户
提问于 2020-10-11 15:53:40
回答 1查看 882关注 0票数 0

我正在使用py魅力来解决这个问题,我似乎不知道如何修复这个错误。

代码语言:javascript
运行
复制
Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py", line 1883, in __call__
    return self.func(*args)
  File "/Users/syedrishad/PycharmProjects/OpenCVPython/venv/Text To Speech.py", line 44, in Text_to_speech
    playsound('DataFlair.mp3')
  File "/Users/syedrishad/OpenCVPython/lib/python3.8/site-packages/playsound.py", line 55, in _playsoundOSX
    from AppKit     import NSSound
ModuleNotFoundError: No module named 'AppKit'

下面是代码:

代码语言:javascript
运行
复制
## import libraries

from tkinter import *
from gtts import gTTS
from playsound import playsound



################### Initialized window####################

root = Tk()
root.geometry('350x300')
root.resizable(0,0)
root.config(bg = 'ghost white')
root.title('DataFlair - TEXT_TO_SPEECH')


##heading
Label(root, text = 'TEXT_TO_SPEECH' , font='arial 20 bold' , bg ='white smoke').pack()
Label(root, text ='DataFlair' , font ='arial 15 bold', bg = 'white smoke').pack(side = BOTTOM)




#label
Label(root, text ='Enter Text', font ='arial 15 bold', bg ='white smoke').place(x=20,y=60)


##text variable
Msg = StringVar()


#Entry
entry_field = Entry(root,textvariable =Msg, width ='50')
entry_field.place(x=20 , y=100)


###################define function##############################

def Text_to_speech():
    Message = entry_field.get()
    speech = gTTS(text = Message)
    speech.save('DataFlair.mp3')
    playsound('DataFlair.mp3')

def Exit():
    root.destroy()

def Reset():
    Msg.set("")

#Button
Button(root, text = "PLAY" , font = 'arial 15 bold', command = Text_to_speech, width =4).place(x=25, y=140)
Button(root,text = 'EXIT',font = 'arial 15 bold' , command = Exit, bg = 'OrangeRed1').place(x=100,y=140)
Button(root, text = 'RESET', font='arial 15 bold', command = Reset).place(x=175 , y =140)


#infinite loop to run program
root.mainloop()

我对此感到非常困惑,其他人的解决方案对我也不起作用。任何帮助都将不胜感激。我已经试着解决这个问题一个星期了。这不是我的密码。我正在学习一个教程,这是我一直在做的项目之一。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-10-11 16:12:17

您没有安装AppKit。这就是为什么翻译抱怨这件事。

你必须安装这个软件包,有两种可能:

终端型pip install AppKit中的

  1. In PyCharm do: Preferences ->项目解释器->单击"+“->类型AppKit ->安装包

看,它现在应该起作用了。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64306050

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档