Is there a way to install Python version 2 on Mac with M3 chips?
1
0
Entering edit mode
5 months ago
xiaoleiusc ▴ 140

Hi, All,

Is there a way to install Python version 2 on Mac with M3 chips?

Thanks,

Xiao

NGS Python • 1.3k views
ADD COMMENT
0
Entering edit mode

Did you try installing it through Conda?

Regards,

Nitin N.

ADD REPLY
0
Entering edit mode

Tried conda create --name env_py2 python=2.7.18 but failed with error below:

Collecting package metadata (current_repodata.json): done Solving environment: unsuccessful attempt using repodata from current_repodata.json, retrying with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed

PackagesNotFoundError: The following packages are not available from current channels:

  • python=2.7.18

Current channels:

To search for alternate channels that may provide the conda package you're looking for, navigate to

https://anaconda.org

and use the search bar at the top of the page.

ADD REPLY
0
Entering edit mode

A quick Google search gave me this solution, which might help.

ADD REPLY
0
Entering edit mode

I think you need to enable the x86_64 packages and run them using Rosetta2. There are multiple options to to this. I have two different conda installations on my M1pro (one using arm64 one using x86_64) and I activate them separately to keep the package architectures separate. However, you can also allow x86_64 packages in arm64 environments: https://stackoverflow.com/questions/70205633/cannot-install-python-3-7-on-osx-arm64

ADD REPLY
0
Entering edit mode
5 months ago
xiaoleiusc ▴ 140

This is how I installed python2 on my MacOS Sonoma (14.5) with M3 chips.

  1. brew install pyenv
  2. pyenv install 2.7.18
  3. pyenv init, and follow instructions to append the following to ~/.zprofile and ~/.zshrc
  4. sudo nano ~/.zshrc, append the following:
    export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export
    PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)"
  1. To exit nano, press “control + x”, the press “y”.
  2. Refresh shell with exec "$SHELL"
  3. Check installed python versions with pyenv versions
  4. Choose a version to run locally or globally, for example, pyenv local 2.7.18 , pyenv global 3.12.4, or use system version with pyenv global system.
ADD COMMENT

Login before adding your answer.

Traffic: 1226 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6