How to install System Python 2.7 on a Mac - macos

I need to know How to install System Python 2.7 on my Mac. This is because, I unknowingly uninstalled it (I thought I was removing the Python I downloaded from Python.org)
I followed this Stack Overflow answer, and after the damage had been done, I read the comments telling me NOT TO do that.
The current reason I am wanting to install System Python 2.7 is because it is needed to install PyGame. Below is a screenshot of what I am facing when trying to install PyGame:

I recommend installing packages on OS X using Homebrew as it keeps everything you install in one place. Allowing you to upgrade or uninstall easily and not needing to remember how or where you installed it.
Once it is installed you simply type brew install python in your terminal. This will install Python 2.7.10 and it will be available at /usr/local/bin/python.

The only supported way to restore the system Python framework on macOS is to reinstall the operating system. It is treated as a component of the core operating system, so there is no way to selectively reinstall it.

Related

Problems installing and opening Anaconda3 on macOS Sierra

I am using a MacBook Pro (early-2011) with macOS Sierra v10.12.6. I can not install and run Anaconda3. I have downloaded the pkg file from the Anaconda webpage. First day, it took overnight to finish installing. After which it said installation failed. I tried to delete all files and reinstall all over again serval times, but this hasn't worked. I made sure the /opt folder was empty before I reinstall again, but even like that didn't work.
Any ideas how to make it work?
Had a similiar problem with a geriatric iMac mid 2010 running OSX 10.13.16. The GUI installer for Anaconda 3 takes an age, then reports there was a problem.
I downloaded the install script and ran, "bash Anaconda3-2022.05-MacOSX-x86_64.sh" in a terminal.
Answered questions, and after some time, have Anaconda installed in my personal space. Now to figure out how to use the latest LTS Julia.
No Anaconda support. Current Anaconda (and likely Miniconda) distribution declares a minimum system requirement of macOS v10.13+. One could try scraping back through the archive to find an older distribution that will install, but I wouldn't recommend that.
Conda Forge supports macOS 10.9+. Conda Forge still builds all osx-64 packages with a macOS 10.9 target. Hence, you should be fine using instead a Miniforge variant for the base Conda installation. I strongly recommend Mambaforge, and using mamba instead of conda.

How to install everything natively without rosetta 2 in M1 macs?

I have been using M1 macbook for almost half a year and initially, I installed many packages under rosetta 2 and many natively (I assume). I run my terminal under rosetta 2 but whenever I install any package using brew, I do it using arch -arm64 brew install <pkg-name>. Now, I have no clue if all this time, I had been installing the packages under rosetta 2 or natively.
Anyways, now I want to install the native versions of all the packages and software since now, most of them are available natively. Please help me to figure out how can I do this. All I want to do is remove everything and then install then natively without rosetta 2.
Some of the things which I want to reinstall are:-
Homebrew
Mini conda and the python libraries.
gcc and g++
MySQL
Node and npm
Also, in future, if I want to install anything natively then how should I do it?
If you used Homebrew to install all of the packages, try to uninstall them as you where using brew. Then uninstall the x86 version of Homebrew
And for the native versions, install the new Homebrew with the ARM terminal. And reinstall everything.

You might be loading two sets of Qt binaries into the same process

I am trying to run python code in virtual environment of conda. The thing is I have installed opencv using brew and using python from anaconda environment. There is library called qt which is in both (brew and conda). Now when I try to run my code it says you are loading two sets of qt binaries in the same process. I understood the error but I don't know how to disable qt binary either from conda or from brew.
After deleting the one from conda it works fine but some dependencies also gets deleted. Don't want that. Can somebody suggest me some way.
If OpenCV's gui functionality is not required, then this is an option to avoid qt conflict.
pip uninstall opencv-python
pip install opencv-python-headless

Install wxpython on mac

I am new to Mac, have always used windows and I am confused on how to install wxPython. I downloaded the .dmg file from the website, and it contained three files:
a pkg file, a readme, and an uninstall.py
I opened the pkg file, went through the steps, and Im not sure where it installed after it said "Installation Complete"
Also, I did the import wx in idle, which caused a stacktrace error.
Thanks.
From personal experience on installing wxPython on both Windows 7 and Mac OSX, I found restarting the computer helps out after installation and stacktrace errors appearing in the Shell upon 'import wx'. Sounds simple enough, but it worked for me. If no errors appear after 'import wx', that means wxPython installed correctly. To add to bouke's answer above, the current way to install Python 2.7 via homebrew in Terminal:
brew install python
To install wxPython:
brew install wxpython
At least for development, I would suggest to install (python and) wx using homebrew. It will install version 2.9 and you're ensured that Apple-provided system libraries remain untouched.

Uninstall python 3.2 on mac os x 10.6.7

According to the documentation from python.org, python 3.2 install on mac os requires an upgrade to tcl/tk 8.5.9 (for use of IDLE). In my haste, I have done both. Now my friend told me that python 3 is not recommended yet because only the built-ins and a few modules have been released for 3. The stable one so far is 2.7 (especially if one wants to make extensive use of a variety of modules). My machine has both 2.6.1 and 3.2 (because some OS services make use of 2.6.1 that comes as default with the OS).
1. How do i remove 3.2 completely to avoid any compatibility issues?
tcl/tk 8.5.9 was also installed and this is not the default. There was no verbose mode during installation, so I don't know whether it replaced the default one. If it did how bad can it be for the OS? and hence
2. If the above is really bad, how do i downgrade to the old version of tcl/tk?
In short, how do i bring my machine back to its original state? If anyone knows all the paths to the directories and files I can do it manually.
Thanks
Since Python installs using a package manager, you can use Suspicious Package to look at the install script and where everything is installed.
Be aware this is for demonstration purposes only. My environment is OSX 10.6.8 and am uninstalling python-3.2.2-macosx10.6.dmg.
sudo rm -Rfv /Library/Frameworks/Python.framework/ /Applications/Python\ 3.2/
cd /usr/local/bin/
sudo rm -fv 2to3 2to3-3.2 idle3 idle3.2 pydoc3 pydoc3.2 python3 python3-32 python3-config python3.2 python3.2-32 python3.2-config python3.2m python3.2m-config pythonw3 pythonw3-32 pythonw3.2 pythonw3.2-32 /Developer/Documentation/Python/Reference\ Documentation\ 3.2
I did the same (3.2 on a mac 10.6) and:
-Moved both the Python 3.2 folder and the ActiveState ActiveTcl folder from the Applications Folder to the Trash.
-Moved the Python.framework folder from the Library/Frameworks folder to the Trash.
Running System profiler shows only the 2.6 version of Python.
Marcos
just uninstall 3x version of python if you have already installed it. Eclipse has that option when you click "see whats already installed".
Install later 2.7 version. It works for me on my OS X 10.9.2 with Eclipse Juno.

Resources