1

I am currently working on a project with python 3.8.6. However, I want to change python's version that I am using to 3.5.3. How can I do this? I'm on a Mac.

I have tried installing python 3.5.3 with the installer from the python downloads website but after it installs and I run python3.5 on my shell, it says

zsh: killed     python3.5

If I run python3.8 on the shell, it works, but I want the 3.5 version so I can then get the sys.executable to then change the path in Wing.

I've also tried pyenv with homebrew but it fails when it tries to install. It says

BUILD FAILED (OS X 11.0.1 using python-build 20180424)

What can I do?

wjandrea
  • 28,235
  • 9
  • 60
  • 81
Guilherme
  • 11
  • 2
  • Pyenv is definitely the way to go for installing multiple versions of Python. When installing pyenv fails, is that all it says, or does it print out any more information? – CrazyChucky Jan 02 '21 at 04:00
  • this is what it says when i try to install python 3.5.3 with penv: ```none BUILD FAILED (OS X 11.0.1 using python-build 20180424) Inspect or clean up the working tree at /var/folders/_w/jxrcdv_90bj_5mw0_3tndbd40000gn/T/python-build.20210102141244.726 Results logged to /var/folders/_w/jxrcdv_90bj_5mw0_3tndbd40000gn/T/python-build.20210102141244.726.log ``` – Guilherme Jan 02 '21 at 14:14

2 Answers2

0

You can try using Conda. Installation: https://docs.conda.io/projects/conda/en/latest/user-guide/install/macos.html

To create environments and switch between them:

conda create -n 3.5.3 python=3.5.3
conda activate 3.5.3
conda env list
ELinda
  • 2,658
  • 1
  • 10
  • 9
0

Support for macOS 11 is still an open issue for pyenv. It's also been asked about before here on Stack Overflow, though due to installing a different Python version, this might not be 100% a duplicate.

One solution that seems to be working for people is that posted in this blog post:

Step 1 Align command-line tools

  • Open Xcode-beta.app
  • Go to Preference > Locations
  • Select the right version of command-line tools

Step 2 Install python

In this case, I installed 3.8.0. If you want to install a different version, you will need to change the version in the following command.

CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.8.0 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)

You may also need to make sure you have the following installed:

brew install zlib bzip2
CrazyChucky
  • 3,263
  • 4
  • 11
  • 25