This project aims to create a simple virtual assistant using Python.
- Install Python: Ensure you have Python installed on your system. You can download it from https://www.python.org/.
- Install Required Libraries:
- SpeechRecognition:
pip install SpeechRecognition
- pyttsx3:
pip install pyttsx3
- wikipedia:
pip install wikipedia
- datetime: (Already included in Python)
- webbrowser: (Already included in Python)
- os: (Already included in Python)
- pyjokes:
pip install pyjokes
- requests:
pip install requests
- beautifulsoup4:
pip install beautifulsoup4
- wolframalpha:
pip install wolframalpha
- SpeechRecognition:
- Open the Project: Navigate to the project directory in your terminal or command prompt.
- Run the Script: Execute the
main.py
file using the commandpython main.py
.
-
Greeting: The assistant greets you when you start it.
-
Voice Recognition: The assistant can understand your voice commands.
-
Text-to-Speech: The assistant can speak back to you.
-
Wikipedia Search: Get information from Wikipedia.
-
Time and Date: Get the current time and date.
-
Open Websites: Open websites in your default browser.
-
Jokes: Tell you a joke.
-
Weather Information: Get the current weather conditions.
-
Wolfram Alpha Integration: Access Wolfram Alpha's knowledge engine for more complex queries.
- Start the assistant: Say "Hey Jarvis" or "Hello Jarvis" to activate the assistant.
- Give commands: Speak your commands clearly and concisely.
- End the session: Say "Goodbye Jarvis" or "Exit" to close the assistant.
- "What's the weather like today?"
- "Open YouTube"
- "Tell me a joke"
- "What is the capital of France?"
- "What is the meaning of life?"
This guide explains how to convert your Python script main.py
into a standalone executable file (.exe) that can run on Windows systems without requiring Python to be installed.
- Python: Ensure you have Python installed on your system. You can download it from python.org.
- pip:
pip
is Python's package installer and should come with your Python installation.
PyInstaller bundles your Python script and its dependencies into an executable file.
pip install pyinstaller
For certain Windows-specific functionalities, you might need the pywin32
package.
pip install pywin32
Ensure you have the latest versions of the gtts
and gtts-token
libraries, which are used for text-to-speech functionality.
python -m pip install --upgrade gtts
python -m pip install --upgrade gtts-token
Important: Navigate to the directory containing your main.py
script in the terminal or command prompt before running the following commands.
Method 1: Using --hidden-import
and --onefile
pyinstaller --hidden-import=pyttsx3.drivers.sapi5 --onefile main.py
--hidden-import=pyttsx3.drivers.sapi5
: This flag explicitly includes thesapi5
driver used bypyttsx3
to avoid potential import errors in the executable.--onefile
: This option creates a single executable file that contains all necessary dependencies.
Method 2: Alternative --hidden-import
pyinstaller --hidden-import=pyttsx3.drivers --onefile main.py
This command is similar to Method 1 but uses pyttsx3.drivers
instead of the specific sapi5
driver. Use this if your project requires different pyttsx3
drivers.
- Executable Location: After running the commands, you will find the generated executable file (
main.exe
) inside thedist
folder in your project directory. - Distribution: You can share the
dist
folder with users. They will be able to run your application without needing Python or any dependencies installed on their system.
-
ValueError: Unable to find token seed! Did https://translate.google.com change?
- This error is related to the
gtts
library. Upgradinggtts
andgtts-token
as mentioned in the installation steps should resolve this issue.
- This error is related to the
-
Other Errors
- If you encounter other errors, carefully review the error messages. They often provide clues about missing dependencies or configuration issues. You can search for solutions online or consult the documentation for the libraries you are using.
This project is licensed under the MIT License - see the LICENSE file for details.