I am trying to figure out how to switch between different Python versions on my Mac using virtualenvwrapper package.
My Mac came with Python2.7 and I've installed the latest version (Python3.7). I have figured out how to make an environment with Python3.7 using the following:
mkvirtualenv -p /usr/local/bin/python3 p3
But when I check PYTHONPATH, VIRTUALENVWRAPPER_PYTHON, and VIRTUALENV_PYTHON, they all point to the original Python 2.7.
How do I know that the environment I created is actually running Python3?
I am new to virtual environments and the Mac world, so this has all be a bit confusing to figure out. I appreciate any input.
Do this:
python3.6 -m virtualenv /path/to/your/venv
This will guarantee your virtualenv to install for that specific python version.
If you are not sure where your python executable is, fire up a python console:
>>> import sys
>>> print(sys.executable)
/full/path/to/your/python/executable
You'll usually find other python versions lying there - usually they're symlinked to your /usr/local/bin/ which will make you able to call them by name , e.g. python3.6
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With