Note: If you don’t know about virtualenv See here
But so you know, virtualenv is a tool to create isolated Python environments. Since Python 3.3, a subset of it has been integrated into the standard library under the venv module. Note though, that the venv module does not offer all features of this library (e.g. cannot create bootstrap scripts, cannot create virtual environments for other python versions than the host python, not relocatable, etc.).
Okay, so on a faithful Friday, i received a project file i had to unzip and work on. As an expert i feel i am ๐ , i unzipped, configured virtualenv, open the code and realize it was made in Python 2, while i have python 3 configured ๐ , not bad.
Peep the API made using Python 3
I pulled google over, and downloaded Python 2 MSI, Install did all my windows environment variables setting as seen below;
Tip: Did you know that if you move the paths up and down, one on top takes precedence over the one below? I notices this when i tried to run ‘Python’ in the CLI. You can try it, if you have multiple versions of python installed
That was just by the way
Alright, now after setting up Python 2.
while in the project directory. i ran virtualenv env in CLI , it is still using c:\\python36. To fix this and use Python27 for virtual env. Just run
Note: Before this, ensure you delete the old env folder which was generated
virtualenv -p C:\\Python27\\python.exe env
Activate the Environment
source ./env/Script/activate
Install your requirements
pip install -r requirements.txt
Now we good! ๐
Leave a Reply