Skip to content

Commit 73794b1

Browse files
Merge pull request #1784 from Nishikant00/patch-1
Added Auto Install pyttsx3 and speechRecognition
2 parents 344bb9f + 4a17788 commit 73794b1

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

JARVIS/JARVIS.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,21 @@
2828
from playsound import * # for sound output
2929

3030
# master
31-
import speech_recognition as sr # speech_recognition Library for performing speech recognition with support for Google Speech Recognition, etc..
32-
33-
# pip install pyttsx3
34-
# need to run only once to install the library
31+
# auto install for pyttsx3 and speechRecognition
32+
import os
33+
try:
34+
import pyttsx3 #Check if already installed
35+
except:# If not installed give exception
36+
os.system('pip install pyttsx3')#install at run time
37+
import pyttsx3 #import again for speak function
38+
39+
try :
40+
import speech_recognition as sr
41+
except:
42+
os.system('pip install speechRecognition')
43+
import speech_recognition as sr # speech_recognition Library for performing speech recognition with support for Google Speech Recognition, etc..
3544

3645
# importing the pyttsx3 library
37-
import pyttsx3
3846
import webbrowser
3947
import smtplib
4048

0 commit comments

Comments
 (0)