how to install multiple python versions on snow leopard? - python

whats is the current best practice for installing multiple versions of python on snow leopard?
have setup python 2.7.1 via Homebrew, very easy process, all great.
but now I need to setup python 2.5 to develop an appengine project.. Initially created a new virtualenv against system python2.5 .. but finding I have all kinds of PATH issues. Seems at this point it would be better not to use Homebrew and go with a more standard setup?
any thoughts ?

Snow leopard already contains python 2.5 and python 2.6, no issues there.
If you require obscure modifications to the python installations, just compile your own, and put it in some place where it won't conflict with the system python. (I suggest /opt/your-pythonx.y).
As an aside, check: "man python" on mac to see how to use the 32-bit, or 64-bit options if that turns out to be neccessary. (Sometimes it is for c modules)

I use the python_select utility to switch between versions (it takes care of all the paths and links). It's easy to install with MacPorts or fink, so I would guess you can install the same utility with Homebrew.

Related

Remove all Python versions and clean install Python 3

I have installed on my MacBook Air (v10.10.5) a number of different Python Versions (2.7, 2.6 + 3). I have tried changing python PATH settings, however, it has become too awkward to maintain. Because of this, I wish to uninstall all versions (without damaging my OS) and then clean install Python 3. How can I do this?
First of, you cannot (and should not!) uninstall a version of python that is shipped with macOS. They are shipped for a reason and might break your system as soon as you remove them (as a lot of essential processes might rely on them).
Python2.7 for instance has been shipped with macOS for a long time. However, you are also able to download and install the same version of python (e.g. 2.7) yourself, which usually means you end up with conflicting versions and controlling your PATH becomes a fulltime job.
You are always safe to remove those versions that you installed yourself (but only those!).
How to do so depends greatly on how you installed them. If you've done so via downloaded packages of python.org look here for uninstall instructions. If you used another application like brew or macports you need to follow the guidelines of those programs which could be easily fetched via a Google search.
Good luck!

Python Versions on Mac

I'm working on Mac Os 10.7 (Lion) and I have some questions:
What is the pre-installed version of python on Lion?
I've been working on this computer for some time now, and i've installed lots of software in order to do college work many times I didn't know what I was really doing. The thing is: now I hava on the /Library/Frameworks/Python.framework/Versions/ a folder called "7.0" I'm pretty sure there no python version 7. Is this folder native or a third-part program installation. Can I delete it? (it's using 1 Gb on disk).
Where is located the original python that comes with mac os?
I've choose Homebrew as my package manager, is there a easy way to manage python versions with it?
Lion uses Python 2.7 by default; 2.5 and 2.6 are also available.
/Library/Frameworks/Python.framework does not exist on a stock install of Lion. My guess is that you've ended up with this by installing some application.
The default Python install is primarily installed in /System/Library/Frameworks/Python.framework, although some components are located elsewhere.
Yes - you can brew install python#2 to get a Python 2.7 separate from the system version, or brew install python to get Python 3.7. Both will install to /usr/local, like any other Homebrew recipe.
I think that is Python 2.7 but you can check typing python on a command terminal. It will tell you the version.
I couldn't tell that you can deleting it, because I don't know what it has... can you give more info about it?
Just type "which python" and it will tell you
You should use virtualenv and pip: http://jontourage.com/2011/02/09/virtualenv-pip-basics/

How to install/organize python modules on a mac?

I have a mbp, but I've been lazy and have been using ubuntu for my python development thus far b/c its so easy to install modules etc.
How do you install modules on a mac? And best-practises with storing all .py files?
See my lengthy answer to a similar question here. Bottom line, if you are familiar and comfortable with a package-managed environment like on Ubuntu, you may want to use a package manager like MacPorts or Fink or Homebrew on OS X. But there are subtle differences since, unlike Ubuntu, this is not the system-wide package manager so you have to be aware of and co-exist with things supplied by Apple in OS X or by having multiple Python installations.
One of the perks of using high level languages is that they function mostly the same on each platform they support. Python is no diffent. You install modules the same way you do on Linux: using easy_install or pip, check them out http://pypi.python.org/pypi/setuptools http://pypi.python.org/pypi/pip

Are there any downsides to upgrading Python on Snow Leopard?

I want to use the newest version of Python on Snow Leopard using the installer package, but I've read some confusing articles about conflicts when upgrading. I plan on using PyDev in Eclipse, will there be any conflicts with Snow Leopard if I upgrade?
To answer your question explicitly: Are there any downsides to upgrading Python on SL? Only if you upgrade the system installation. It can have strange repercussions on any system/CLI tools that use Python, and on any bundled applications (.app) that are utilizing PyObjC runtime libraries.
I would not upgrade, tangle with, or otherwise modify the default installation of Python, if that's what you are asking. You are much better off installing an upgraded version of Python in an alternate location using MacPorts.
MacPorts installs everything into /opt/local (i.e. /opt/local/bin/python) by default. You can then also install python_select which does some jiggering to make sure that whichever version you choose will be preferred based on your PATH.
You might want to consider using virtualenv coupled with pip for managing this environment as well, unless you become accustomed to MacPorts. Things to consider!

Install PyObjC on Python 2.6 on OS X 10.5?

OS X 10.5.8 came with Python 2.5, and had PyObjC already installed.
I installed Python 2.6 from the python.org site, and PyObjC isn't there.
I can't find a download to install PyObjC on my Python 2.6 install. Is checking out the PyObjC trunk and trying to build it my only choice? Will that work "out of the box"?
Apple includes PyObjC with their Pythons that come with OS X 10.5 and 10.6. It is not part of the python.org installers. But it should be easy enough to install. Just install setuptools to the python.org python 2.6 following the instructions here. Then use easy_install-2.6 (which will have been installed in /Library/Frameworks/Python.framework/Versions/2.6/bin and may already be on your $PATH) to do:
easy_install-2.6 pyobjc==2.2b2
as described here. If you want to live on the bleeding edge, you could try installing directly from the svn repository as there has been a lot of work recently, primarily in support of 10.6.
If that seems like too much work, you could install an older version and all dependencies including python via MacPorts:
sudo port install py26-pyobjc2
You should probably try to build PyObjC from trunk, which will work fine on the official Python 2.6 distribution, but not on Python 2.5. There are quite a lot of fixes in the trunk right now that weren't in 2.2b2, which afaik. is the most current version available through easy_install.
There are some little snags that you may run into when building with py2app on 10.5 + 2.6 + PyObjC 2.2 (which for a lot of reasons is what you should probably do, instead of using the Xcode templates from 10.5 that build differently), especially if you still have Python 2.5 installed somewhere, so you'll probably want to build and install py2app from trunk as well, this particular issue I ran into with PyObjC 2.2 on 2.6 on 10.5 has been fixed by now.
If your goal is to write software that will work on other people's computers, you shouldn't touch the default Python installation. If you simply cannot live without 2.6, then you're responsible for re-creating everything on your own, and that's not going to be a point-and-click process by any means.

Categories

Resources