I've tried several ways to downgrade the python3, including using pyenv, but it has the build failed error. I think it's probably because my python3 is in my usr/bin folder and I can not delete it. For the course requirement, I really need to downgrade python to 3.5. Is there any way to do so?
-
5It is best to create a virtual environment with the required python version (e.g. 3.5) and leave the system python (3.8) as it is. – Dan Constantinescu Aug 24 '22 at 06:35
-
1A possible solution may be found here: https://stackoverflow.com/questions/52584907/how-to-downgrade-python-from-3-7-to-3-6 There are many proposed solutions. I hope this helps. – Konstantinos Giannakopoulos Aug 24 '22 at 06:42
-
you could try using anaconda as it makes it effortless to manage multiple python versions and their associated environments. – mahieyin-rahmun Aug 24 '22 at 06:43
2 Answers
I recommend using Anaconda to install the specific python version. like it:
conda create -n py35 python=3.5

- 108
- 1
- 7
First of all, install brew
if is not already installed. Then add it to user path by:
export PATH=/opt/homebrew/bin:$PATH
Once done Restart your shell:
exec zsh -l
Now Check Python is located where:
which python
Next, Go through following steps:
Check if you have pyenv already installed on mac OS.
pyenv --version
-- Optional since you already stated that pyenv is present at your machine.List all available version for python:
pyenv install --list
Install desired python version:
pyenv install 3.5
Set python 3.5 version globally:
pyenv global 3.5
Check again if python is located whether in user's directory:
which python
it should be pointing to your /Users/usrone/.pyenv/shims/python
if not then set it again : pyenv global 3.5
Update your .zshrc
if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)" fi PATH=$(pyenv root)/shims:$PATH
Restart zsh terminal:
exec zsh -l
You can also read excerpts from Downgrade Python version SO answer

- 217
- 1
- 3
- 17