it gets worse (was: How do you configure IDLE on a Mac...)

Ned Deily nad at acm.org
Tue Jan 5 23:03:45 CET 2010


In article 
<6672dad2-26ba-458b-8075-21bac6506179 at e37g2000yqn.googlegroups.com>,
 Mensanator <mensanator at aol.com> wrote:
[...]
> So, for all practical purposes, the macports install is broken also.
> 
> IDLE simply does not work in an X11 window (you think someone would
> have noticed that). The missing preferences is just the beginning.
> Apparently NONE of the menu item shortcuts work.
> 
> For example, the Cut, Copy, Paste shortcuts are given as Command-X,
> Command-C and Command-V. But that doesn't work in an X11 window,
> apperently only in an Aqua Tk (parent application appears as IDLE).
> 
> Of course, I can do Control-X, Control-C and Control-V to do Cut,
> Copy and Paste. Don't know if this works for all shortcuts, but
> I suppose I could just pick them from the menu (and I can bang
> my head against the wall while I'm at it).
> 
> What do you think, suppose I copy the gmpy built with the macports
> install over to the directory where the python.org version is? Would
> it
> import? If that'll work, I can switch back to using the python.org
> install and use it's version of IDLE. I certainly won't be needing
> distutils once I have a working version of gmpy.

Let's go back to your original problem, which, if I understand 
correctly, was trying to get going with Python 3 and gmpy on OS X 10.6.   
(Sorry I was away over the holidays and didn't get a chance to respond 
to your original postings at the time.)  I believe the problems you 
originally encountered with installing gmpy were all due to a couple of 
problems with building C extension modules on 10.6 when using the 
current 3.1.1 OS X python.org.  Unfortunately, 3.1.1 was released before 
10.6 was so there are a couple of important fixes that haven't yet been 
released for 3.1 (but are in the 2.6.4 installer which was released 
after 10.6 came out).  Fortunately, though, there are simple workarounds 
for the problems.  Keep in mind, though, that, at the moment, the 
python.org installers for OS X are 32-bit only; that will change in the 
future but if you do need a 64-bit Python 3 you'll need to stick to 
other solutions like MacPorts for the time being.

First, make sure the gmp library you've installed has 32-bit support.  
If you installed it using MacPorts, check with the file command:

$ file /opt/local/lib/libgmp.dylib
/opt/local/lib/libgmp.dylib: Mach-O universal binary with 2 architectures
/opt/local/lib/libgmp.dylib (for architecture i386):  Mach-O dynamically 
linked shared library i386
/opt/local/lib/libgmp.dylib (for architecture x86_64):   Mach-O 64-bit 
dynamically linked shared library x86_64

If it doesn't have an i386 variant, reinstall the gmp library from 
MacPorts:

$ sudo port selfupdate    # make sure MacPorts is up-to-date
$ sudo port clean gmp
$ sudo port install gmp +universal     # install 32-/64-bit variants

Second, you need to install the MacOSX10.4u SDK because the current 
python.org pythons are built with it.  That SDK is included in the Snow 
Leopard Xcode installer package but it is not installed by default.  
There should be an Xcode.mpkg somewhere, perhaps on your hard disk if 
your system came with Snow Leopard factory-installed or perhaps on a 
restore DVD.  If not, it's on the retail Snow Leopard DVD and can be 
downloaded from the Apple Developer site.  After launching the Xcode 
installer, just select and install the "Mac OS 10.4 Support" package 
from the Custom Install menu.

Third, you need to tell Distutils to use the older gcc-4.0 instead of 
the gcc-4.2 which is now the default on 10.6.

$ cd /path/to/gmpy-1.11rc1
$ export CC=/usr/bin/gcc-4.0
$ /usr/local/bin/python3.1 setup.py install
...
$ /usr/local/bin/python3.1 test3/gmpy_test.py
Unit tests for gmpy 1.11
    on Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04) 
[GCC 4.0.1 (Apple Inc. build 5493)]
Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
...
1500 tests in 42 items.
1500 passed and 0 failed.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list