I've used pyenv to install Python 3.8.11 and 3.9.6 on my mac (Big Sur os) and set 3.8.11 to be the version of Python that I want to use for creating a virtual environment (followed the instructions here). But, even though I've set up system to use 3.8.11, the virtual environment that results seems to be using Python 3.8.2.
This is what I did:
Install pyenv via Homebrew
Install Python 3.8.11 and 3.9.6 via
pyenv install 3.X.X
Added
eval "$(pyenv init -)"
to~/.bash_profile
which was an empty fileTyped
pyenv local 3.8.11
in the terminal and thenpyenv versions
in the terminal to confirm that 3.8.11 was being used:$ pyenv versions system * 3.8.11 (set by /Users/me/projects/sample/.python-version) 3.9.6
But, when I typed python3 -V
in the terminal, my system indicates that Python 3.8.2 being used:
$ python3 -V
Python 3.8.2
When I type which python3
, the system shows the path to python3 (presumably 3.8.2) as /usr/bin/python3
:
$ which python3
/usr/bin/python3
I don't recall when/how Python 3.8.2 was installed on my machine. I did try to uninstall with brew uninstall python@3.8
but the system returned:
$ brew uninstall python@3.8
Error: No available formula or cask with the name "python@3.8". Did you mean python@3.8, python@3.9, python@3.7 or python-yq?
Taking a gamble anyways because I was stuck, I typed python3 -m venv virtual_env
to create my virtual environment, hoping that the new environment would be the version of python that I wanted but after activating my virtual environment using source virtual_env/bin/activate
, I entered python -V
and confirmed that the resulting environment was using Python 3.8.2 instead of 3.8.11:
(virtual_env) me$ python -V
Python 3.8.2
Can somebody tell me what I'm missing/doing wrong? What's the best way to get past this problem?