create a virtualenv python
pip install virtualenv
cd projectfolder #go to project folder
virtualenv projectname #create the folder projectname
source projectname/bin/activate
create a virtualenv python
pip install virtualenv
cd projectfolder #go to project folder
virtualenv projectname #create the folder projectname
source projectname/bin/activate
create virtual environment python
sudo pip3 install virtualenv
virtualenv venv
how to make a virtual assistant with python
import speech_recognition as mic
import pyttsx3
import pywhatkit
import datetime
import wikipedia
import pyjokes
listener = mic.Recognizer()
engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def talk(text):
engine.say(text)
engine.runAndWait()
def take_command():
try:
with sr.Microphone() as source:
print('Yeah I am listening!')
voice = listener.listen(source)
command = listener.recognize_google(voice)
command = command.lower()
if 'google' in command:
command = command.replace('google', '')
print(command)
except:
pass
return command
def run_alexa():
command = take_command()
print(command)
if 'play song' in command:
song = command.replace('play', '')
talk('playing ' + song)
pywhatkit.playonyt(song)
elif 'time' in command:
time = datetime.datetime.now().strftime('%I:%M %p')
talk('The current time is ' + time)
elif 'who is' in command:
person = command.replace('who the heck is', '')
info = wikipedia.summary(person, 1)
print(info)
talk(info)
elif 'date' in command:
talk('sorry, I have a headache')
elif 'are you single' in command:
talk('No, my best freind is you!')
elif 'joke' in command:
talk(pyjokes.get_joke())
else:
talk('Sorry I did not get that')
while True:
run_alexa()
#you have to install the following by the commands.Just copy and paste each text given
#below, you can paste it on the code editors terminal or in cmd.
#pip install SpeechRecognition
#pip install pyttsx3
#pip install pywhatkit
#pip install DateTime
#pip install wikipedia
#pip install PyAudio
#pip install pyjokes
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us