---
title: "在Mac OS上运行wxPython"
author: "huangro"
date: "2010-09-14T15:42:31Z"
tags: ["Apple", "OS", "Python", "wxPython"]
categories: ["编程语言"]
slug: "mac-os-wxpython"
draft: false
lastmod: "2010-09-14T15:42:31Z"
id: 763075
url: "https://huangro.iteye.com/blog/763075"
---

如果在一个64位的Mac上跑wxPython, 将会出现以下错误:

```log

ImportError: /usr/local/lib/wxPython-unicode-2.8.10.1/lib/python2.6/site-packages/wx-2.8-mac-unicode/wx/_core_.so: no appropriate 64-bit architecture (see "man python" for running in 32-bit mode)

```

原因是现在wxPython需要在本机上以32位python运行.  

解决方案如下: 
在当前用户的HOME目录的.profile文件中添加如下一行：

```shell

export VERSIONER_PYTHON_PREFER_32_BIT=yes

```


如果要临时执行,则可以在终端中执行以上命令. 

另外一种解决方案是执行以下命令:

```shell

defaults write com.apple.versioner.python Prefer-32-Bit -bool yes

```