'How do I activate Python 2.7 in virtual environment in my Mac Terminal [duplicate]
I am trying to create a virtual environment on my Mac using terminal commands for Python 2.7 but it is not working.
I issue the following commands;
mkdir Environments
cd Environments
python -m virtualenv python27
source python27/bin/activate
python --version
Instead of reporting the version of Python as 2.7 it still says I have version 3.9.7. Terminal displays the following but the version option doesn't report Python 2.7
(python27) (base) StephenLearmonth@Stephens-MBP Environments % python --version
Python 3.9.7
I have macOS Monterey 12.3.1 and when I type zsh --version I get;
zsh 5.8 (x86_64-apple-darwin21.0)
Solution 1:[1]
Python2 is end-of-life and was removed from MacOS starting at version 12.3
If you have a strong need for Python2, then you'll need to install it separately (or use Docker), as virtualenv cannot create Python2 environments without having the Python2 interpreter installed first.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
