While developing the automated stock trading program, I encountered a situation where the program couldn’t run in a 64-bit environment. As an alternative, I looked into setting up a 32-bit virtual environment. Most sources recommended Anaconda, but that seemed cumbersome. After searching for alternatives, I found a way to open a 32-bit virtual environment in VS Code. Following the steps was not difficult, so I’ve briefly documented the method here.

Installing the Virtual Environment

python -m venv filename

cd Scripts
.\Activate.ps1

deactivate

Simply enter these three commands to create a file at the desired location. The virtual environment can be activated by calling the Scripts/Activate.ps1 file and deactivated by entering the deactivate command. If (venv) appears before the file path in the VS Code console, the virtual environment is running correctly.

Troubleshooting

C:\Users\UserNameHere\AppData\Local\Programs\Python\Python311-32\python.exe -m venv venv32bit

If the 32-bit virtual environment does not open even after following the steps above, install 32-bit Python and directly call the 32-bit python.exe from the console to resolve the issue.