更新时间:2023-01-20 10:46:38
听起来好像您正在尝试使用来自 64 位 Python 的 32 位库.似乎有一个非正式的可用于Snow Leopard的64位Numpy .
Sounds as though you might be trying to use a 32-bit library from a 64-bit Python. Looks like there's an unofficial 64-bit Numpy available for Snow Leopard.
在此处可用的Python 2.6 .dmg确实是32位的.(具体地说,它是一个既包含i386版本又包含ppc版本的通用二进制文件).此处可用的常规numpy和scipy .dmg版本也是如此.(我怎么知道?请参见下文!)因此,如果您一起使用这些发行版,您会没事的.
The Python 2.6 .dmg available here is indeed 32-bit. (Specifically, it's a universal binary containing both i386 and ppc versions). The same is true of the regular numpy and scipy .dmg releases available here. (How do I know? See below!) So if you use those releases together you should be fine.
但是您还不行-所以我想您不是在使用所下载的2.6 .dmg中的Python版本.如果您正在运行可执行的python脚本,例如:
But you're not fine - so my guess is you're not using the version of Python from the 2.6 .dmg you downloaded. If you're running an executable python script, e.g.:
$ ./my-script.py
然后您可以尝试在命令行上显式指定要使用的Python.看起来MacPython .dmg安装到/usr/local/bin/python,所以请尝试:
then you could try specifying the Python you're using explicitly on the command line. Looks like the MacPython .dmg installs to /usr/local/bin/python, so try:
$ /usr/local/bin/python2.6 myscript.py
高兴吗?
我如何确定体系结构的那些.dmg文件的内容用于...
How I determined the architecture the contents of those .dmg files are built for...
使用gunzip和pax将包内容解压缩到本地目录,例如:
Use gunzip and pax to unpack the package contents to a local directory, e.g.:
$ mkdir tmp
$ cd tmp
$ gunzip -c /Volumes/Universal\ MacPython\ 2.6/MacPython.mpkg/Contents/Packages/PythonUnixTools-2.6.pkg/Contents/Archive.pax.gz | pax
使用 file
检查软件包内容中的二进制文件
Use file
to examine binary files in the package contents
$ file Versions/2.6/bin/python
Versions/2.6/bin/python: Mach-O universal binary with 2 architectures
Versions/2.6/bin/python (for architecture ppc): Mach-O executable ppc
Versions/2.6/bin/python (for architecture i386): Mach-O executable i386