# Create a virtual environment
python -m venv venv # Windows
python3 -m venv venv # MacOS/Linux
# Activate the virtual environment
venv\Scripts\activate # Windows
source venv/bin/activate # MacOS/Linux
# Install required packages
pip install kivy
# Create requirements.txt file
pip freeze > requirements.txt
# Run a test script
python test.py
--------------------------
in case of an error --
PS D:\Coding Stuff, Editing\Visual Studio Python Codings\MyProjects\BurgerBillingSystem> .\burger-billing-system-env\Scripts\activate
.\burger-billing-system-env\Scripts\activate : File D:\Coding Stuff, Editing\Visual Studio Python
Codings\MyProjects\BurgerBillingSystem\burger-billing-system-env\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled on this system.
For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ .\burger-billing-system-env\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
The error message you're encountering indicates that running scripts is disabled on your system's PowerShell execution policy. This is a security measure to prevent malicious scripts from running.
Here's how to fix this and activate your virtual environment:
Change the Execution Policy (For Administrators Only):
Open PowerShell as Administrator. Right-click on the PowerShell icon and select "Run as administrator".
Type the following command and press Enter:
PowerShell
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Use code with caution.
content_copy
This sets the execution policy to allow running scripts signed by a trusted publisher.
Activate the Virtual Environment (After Policy Change):
Navigate to your project directory using the cd command in PowerShell.
Run the activation command again:
PowerShell
.\burger-billing-system-env\Scripts\activate
Use code with caution.
content_copy
This should now activate your virtual environment named "burger-billing-system-env".
Important Note: Changing the execution policy can be a security risk if you're not careful. Only run scripts from trusted sources. If you're unsure about the risks, consider activating the virtual environment from the Command Prompt instead, where script execution might be allowed by default.