1. Set Up a Python Virtual Environment on Windows (CMD
Compatible)
- Install
Python (if not already installed).
- Open
Command Prompt and Navigate to Your Project Directory:
cmd
- Create
a Virtual Environment:
cmd
- Activate
the Virtual Environment:
In CMD, use:
cmd
If using PowerShell, the command would be slightly
different:
powershell
- Install
Dependencies:
cmd
2. Copy the Virtual Environment to the Server
Since Windows CMD does not support native tar and scp
commands, you’ll need some workarounds:
- Compress
the Virtual Environment Using a Tool Like 7-Zip:
- Right-click
on the venv folder and compress it into a .zip file using 7-Zip or a
similar tool.
- Name
the file venv.zip.
- Transfer
the Archive to the Server:
Use an FTP client (e.g., FileZilla) or, if you have
installed the Windows Subsystem for Linux (WSL), you can use scp in a WSL
terminal:
bash
- Decompress
on the Server:
Log into your server and navigate to the directory where you
copied venv.zip, then unzip it:
bash
- Activate
the Virtual Environment on the Server:
bash
- Verify
Dependencies:
Run pip freeze to confirm all required packages are present
and install any missing ones if needed.