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.
Related
I was wondering if it is possible to use Cocoa (Apple's API) with Python, so being able to run any code like in this link, so NSWorkspace functions and so on, this might be a super stupid question, but I was still wondering if it was possible...
Yes.
There are Python packages, kind of wrappers around Objective-C, install them like:
$ pip install pyobjc-core
$ pip pyobjc-framework-Cocoa
$ pip pyobjc-framework-Quartz
https://pypi.org/project/pyobjc-framework-Cocoa/
MacOS by default comes with python 2.7 and pyObjC 2.5, and has done for years. If you want a newer version of either python, such as python 3, or the newest version of pyObjC, then you have to install it yourself.
The latest version of pyObjC is 5.2.
However, on a default installation of MacOS from at least Snow Leopard onward, the following should work:
python
>>> import Appkit
>>> AppKit.NSWorkspace.sharedWorkspace().runningApplications()
Catalina is stated to be the last version to contain python bundled.
What is the latest version of Python that works for Mac OS 10.4.11?
(This would be a version of Python 3 unless none of those work for that OS.)
When I looked on the Python website for Python 3, I saw references to the
Mac OSes 10.6 and 10.5, but not to Mac OS 10.4 or any earlier Mac OS.
Current versions of Python 3 and Python 2 can be made to work on OS X 10.4.11. As you've noticed, as of Python 3.3 python.org no longer provides binary installers that support OS X 10.4. However, there are binary installers available for Python 3.2.x that do work on OS X 10.4 if you just want to try something with 3.2.5. It's not too difficult to build a current Python 3.3 or pre-release 3.4 on 10.4 from source assuming you don't need every standard library module, as there are a number of libraries that are either not provided with OS X or are very old on 10.4. But if you are planning to do serious work with Python and/or will need to install third-party extension modules, I strongly suggest installing Python 3.3 (or 3.4) using MacPorts. The MacPorts project supports 10.4 on a best-effort basis; I have a current 10.4 MacPorts test system with Python 2.7, 3.3, and 3.4 installed so I know it works. MacPorts will install current versions of all the necessary third-party libraries and there are also port files for hundreds of third-party Python packages. It should save you lots of time and effort in the long run if you are going to be using 10.4 for a while.
According to the website, the mac installers for python 3 do not support OSX 10.4. However, the programming language itself should work for all versions of python including 3.3 (the latest stable version). But you will have to compile it from the source yourself.
here's the link for the python 3.3 source:
http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tgz
the readme has the instructions for installing it once you unzip it.
you should also be able to install it using homebrew:
http://blog.manbolo.com/2013/02/04/how-to-install-python-3-and-pydev-on-osx
Hope that helps! I don't have OSX 10.4 so I was not able to test this. I'd be interested to know how it goes.
I've read that there's a nice text-to-speech package called pyttsx that can be included in my Python scripts. As soon as I try to install pyttsx things start falling apart fast. pyttsx is for Python 2.6 (2.7 maybe?) not 3.3. I have 2.7 and 3.3 (also Portable Python 2.7 and 3.2) installed but I can't get setuptools or easy_install to work. I got distribute partly installed but I'm might have seen some errors at the end of its installation so I'm not sure it's working and it won't install pyttsx anyway. There's a Windows .exe program that will let you install Python packages but it won't work for 64-bit Python. I've been searching for answers for days can can't come up with anything specific enough.
How do I install Python packages with 64-bit Python 3.3 on 64-bit Windows 7, or is that even possible?
Best source ever!
this man is a wicked fellow.
With distribute installed, launch the python.exe you want to use.
From within python interactive, run the following code:
from setuptools.command import easy_install
easy_install.main(["-U", "package"])
Substitute "package" for whatever you wish to install.
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/
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.