Python version shipping with Mac OS X Snow Leopard? - python

I would appreciate it if somebody running the final version of Snow Leopard could post what version of Python is included with the OS (on a Terminal, just type "python --version")
Thanks!

It ships with both python 2.6.1 and 2.5.4.
$ python2.5
Python 2.5.4 (r254:67916, Jul 7 2009, 23:51:24)
$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)

bot:nasuni jesse$ python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Probably the biggest reason I went and upgraded this morning, it's not 2.6.2, but it's close enough.

http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/python.1.html

Python 2.6.1
(according to the web)
Really good to know :)

You can get an installer for 2.6.2 from python.org, no reason to go without.

Related

bbfreeze picks wrong python path

After upgrading to ActivePython 2.7.5.6 from ActivePython 2.7.3, bbfreeze fails with several import errors, e.g. ImportError: cannot import name MAXREPEAT. I traced the issue and it is with wrong Python version/installation picked by bbfreeze. It is weired that currently there are two system Python installations:
bash-3.2$ python
Python 2.4.3 (#1, Jun 11 2009, 14:09:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
and:
ash-3.2$ /usr/bin/python2.7
Python 2.7 (r27:82500, Sep 24 2010, 08:01:50)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
and a local installation:
bash-3.2$ ActivePython-2.7/bin/python
ActivePython 2.7.5.6 (ActiveState Software Inc.) based on
Python 2.7.5 (default, Sep 16 2013, 23:05:39)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
but embeded python compler in bbfreeze give a different one, i.e. none of a bove:
bash-3.2$ bin/py
Python 2.7.1 (r271:86832, Dec 5 2010, 11:36:33)
[GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(MyConsole)
I even don't know where this Python 2.7.1 is installed! Any idea how to force bbfreeze to use the local python directory. I already used virtualenv, but didn't work.
Thanks.
#AsoAgile
I downgraded ACtivePython to 2.7.3 and reinstalled bbfreeze and it worked. So bbfreeze turned out to be not supporting ActivePython 2.7.5.

Change SQlite3 version used by Python 2.6 on Mac 10.6.8

I am writing a simple Python script that fetches data from a sqlite3 database. I am experiencing the following error:
sqlite3.DatabaseError: file is encrypted or is not a database
I found out that this error is caused by a version problem of sqlite3. On the Mac (10.6.8) I need to use for now the SQLite version is 3.6.12. I downloaded SQLite 3.7.16.2 and can open the database with that version. But how can I tell Python to use the non-standard SQLite version in that script?
I am using
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Eventually I will use Ubuntu for that project but for testing purposes I need to run the script on that particular Mac configuration.
Thanks for helping!
Another option is to install a newer Python. For instance, the current python.org Python 2.7.4 installers (available here) ship with SQLite 3.7.13.
$ /usr/local/bin/python2.7
Python 2.7.4 (v2.7.4:026ee0057e2d, Apr 6 2013, 11:43:10)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
>>> sqlite3.sqlite_version_info (3, 7, 13)
You can use DYLD_LIBRARY_PATH environment variable to place the directory of a replacement sqlite .dyld earlier in the search path. See man dyld. This is similar to LD_LIBRARY_PATH on Linux.

Running Python 3.2 and 2.7 on the Same Machine

Is there an easy way to run both Python 2.7 and 3.2 on an OS X machine? I have been using IDLE with Python 3.2 and have numerous programs written using Python 3, so I don't really want to uninstall 3. However, I'm working on an assignment that uses 2.7 for a lot of its base code, so I'd like to be able to run 2.7.
OS X 10.7 and 10.8 come with Python 2.7 pre-installed; /usr/bin/python:
$ /usr/bin/python2.7
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Installing additional versions of python isn't prohibited however; the Python for Mac 2.7.3 installer won't interfere with the system install or your Python 3 installation.

MacPorts on Snow Leopard: Python install seems to succeed but doesn't install a non-system Python

I've installed Python via MacPorts. According to this question, the files in /opt/local/bin should run the "correct" Python version. However, all those files are symlinks to:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/
Running them directly from that folder (using no symlinks) runs an Apple build of Python!
Python 2.6.6 (r266:84292, Jan 6 2011, 13:25:25)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
For comparison, running /usr/bin/python shows a slightly different version:
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
They're both Apple builds! How do I install the correct version?
There are no "Apple builds" except the system Python (which is 2.6.1 on Snow Leopard, afai can deduce). The ports install seems to have worked as expected in this case. The reference to Apple is a reference to which GCC that was used.
I think it is running the build you want.
macports install every thing in /opt/local. So /opt/local/bin/python is a macport distribution.
/usr/bin/python is pre-install python distribution that comes with mac os x.
The following line, is an information about gcc build which is used for building macport python distribution.
[GCC 4.2.1 (Apple Inc. build 5664)]
If you have multiple versions of macport python installed, you can select the version using python-select
sudo port install python-select sudo
python-select python26
Also to ensure that you use macport python you could add the following to the PATH
export PATH=/opt/local/bin:$PATH

How to install Python 3.1.2 on Mac OS X 10.6.4?

Hi there I have downloaded the mac installer here, http://www.python.org/download/releases/3.1.2/ , & installed it. But when I run terminal & type python it says:
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
What I want to know is, is it safe to run Update Shell Profile.command in the Python 3.1 folder ? or should I run python 3.1.2 separately ? If I should run python 3.1.2 separately, how do I do so ? also how do I start IDLE ?
Is there another python executable, perhaps python31?
You can also install other python versions via MacPorts if you need (although you'll still have to choose the right executable).
This should also be relevant: Multiple versions of Python on OS X Leopard

Categories

Resources