I am working on a OS X 10.7 with Python 2.7 from python.org and XCode 4.2.
我正在使用python.org和XCode 4.2中的Python 2.7开发OS X 10.7。
- Following these instructions, I tried changing the
CC
,CXX
, andFFLAGS
variables and install withsudo pip install numpy
. However, the installation still looks forgcc-4.2
. - 按照这些说明,我尝试更改CC、CXX和fflag变量,并使用sudo pip安装numpy进行安装。但是,安装仍然需要gcc-4.2。
- I tried installing
gcc-4.2
through MacPorts but get thatError: gcc42 does not build on Snow Leopard or later.
- 我尝试通过MacPorts安装gcc-4.2,但是得到了这个错误:gcc42不构建在Snow Leopard或以后。
-
When I install numpy from the precompiled binary on sourceforge, I get the following error:
当我从sourceforge的预编译二进制文件中安装numpy时,我得到了以下错误:
import numpy
进口numpy
Traceback (most recent call last):
回溯(最近一次通话):
File "", line 1, in
文件“”,第1行
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/init.py", line 137, in
文件“/Library/ framework/ Python.framework/ version /2.7/lib/python2.7/site-packages/numpy/init.py”,第137行,in
import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in
文件“/库/框架/Python.framework/ version /2.7/lib/python2.7/站点包/numpy/add_newdoc .py”,第9行
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/init.py", line 4, in
文件“/Library/ framework/ Python.framework/ version /2.7/lib/python2.7/site-packages/numpy/lib/init.py”,第4行
from type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in
文件“/Library/框架/框架/Python.framework/ version /2.7/lib/python2.7/site-packages/numpy/lib/type_check.py”,第8行
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/init.py", line 5, in
文件"/库/框架/Python.framework/版本/2.7/lib/python2.7/site-package /numpy/core/init.py",第5行。
import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper
框架/版本/2.7/lib/python2.7/站点包/numpy/core/ multiarray2):没有找到合适的图像。框架/版本/2.7/lib/python2.7/站点包/numpy/core/ multiarrayso:在通用包装器中没有匹配的架构
Any help?
任何帮助吗?
2 个解决方案
#1
12
If I recall correctly the precompiled binary on source forge is 32-bit. It took me ages to get Numpy, Scipy, and Matplotlib set up on my macbook, it's definitely much harder than it should be.
如果我没记错的话,source forge上的预编译二进制文件是32位的。我花了很长时间才在我的macbook上安装了麻木、Scipy和Matplotlib,这肯定比应该的要难得多。
I believe that your best option is the Scipy superpack. Before using the superpack you need to update to Xcode 4.3.2
我相信你最好的选择是Scipy superpack。在使用superpack之前,您需要更新到Xcode 4.3.2
So I just installed python 2.7.2 from python.org, grabbed the superpack, and now have numpy working on my machine. After installing python 2.7.2, I did sudo pip uninstall numpy
, which didn't remove enough. So I cd'd into /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
and moved both the numpy directory and the numpy egg to "old" versions of themselves. Then I ran sh install_superpack.sh
and answered no to the "are you installing from a repository cloned to this machine(pretty important lol, hit yes without thinking the first time).
所以我刚从python.org上安装了python 2.7.2,抓住了超级包,现在我的机器上有了numpy。在安装了python 2.7.2之后,我做了sudo pip卸载,它没有移除足够的内容。因此,我将数据保存到/Library/ framework/ Python.framework/ version /2.7/lib/python2.7/site-packages/并将numpy目录和numpy egg都移动到它们自己的“旧”版本。然后我运行sh install_superpack。sh并回答“您是否正在从一个克隆的存储库安装到这个机器(非常重要的lol,不加思索地点击yes)”。
However, now I'm able to do this:
然而,现在我可以做到:
$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import matplotlib
With no problems :)
没有问题:)
#2
4
SuperPack worked for me (thanks, @Nolen) on OS X 10.8 (Mountain Lion) w/ XCode 4.5.1 installed.
SuperPack为我(谢谢,@Nolen)在OS X 10.8 (Mountain Lion) w/ XCode 4.5.1中工作。
Numpy worked for me using pip install numpy
after step #1 below. But scipy would not install using pip. SuperPack fixed this.
Numpy在下面的步骤#1之后使用pip安装Numpy为我工作。但是scipy不会使用pip进行安装。SuperPack固定。
The only thing I did differently was to use HomeBrew to install Python as step #1, rather than download it manually.
我做的唯一不同的事情是使用HomeBrew将Python安装为步骤1,而不是手动下载。
-
Install Python (separate from version that comes with OS X 10.8)
安装Python(独立于OS X 10.8版本)
brew install python --framework --universal
- brew安装python——框架——通用
pushd /System/Library/Frameworks/Python.framework/Versions
- pushd /系统/图书馆/框架/ Python.framework /版本
sudo rm Current
- sudo rm当前
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current
- sudo ln - s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework /版本/电流
popd
- popd
-
Install SuperPack:
安装SuperPack:
curl -o install_superpack.sh https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
- curl - o install_superpack。sh https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
sh install_superpack.sh
- sh install_superpack.sh
- (type your admin password several times during the installation...)
- (在安装过程中多次输入管理密码…)
#1
12
If I recall correctly the precompiled binary on source forge is 32-bit. It took me ages to get Numpy, Scipy, and Matplotlib set up on my macbook, it's definitely much harder than it should be.
如果我没记错的话,source forge上的预编译二进制文件是32位的。我花了很长时间才在我的macbook上安装了麻木、Scipy和Matplotlib,这肯定比应该的要难得多。
I believe that your best option is the Scipy superpack. Before using the superpack you need to update to Xcode 4.3.2
我相信你最好的选择是Scipy superpack。在使用superpack之前,您需要更新到Xcode 4.3.2
So I just installed python 2.7.2 from python.org, grabbed the superpack, and now have numpy working on my machine. After installing python 2.7.2, I did sudo pip uninstall numpy
, which didn't remove enough. So I cd'd into /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
and moved both the numpy directory and the numpy egg to "old" versions of themselves. Then I ran sh install_superpack.sh
and answered no to the "are you installing from a repository cloned to this machine(pretty important lol, hit yes without thinking the first time).
所以我刚从python.org上安装了python 2.7.2,抓住了超级包,现在我的机器上有了numpy。在安装了python 2.7.2之后,我做了sudo pip卸载,它没有移除足够的内容。因此,我将数据保存到/Library/ framework/ Python.framework/ version /2.7/lib/python2.7/site-packages/并将numpy目录和numpy egg都移动到它们自己的“旧”版本。然后我运行sh install_superpack。sh并回答“您是否正在从一个克隆的存储库安装到这个机器(非常重要的lol,不加思索地点击yes)”。
However, now I'm able to do this:
然而,现在我可以做到:
$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> import scipy
>>> import matplotlib
With no problems :)
没有问题:)
#2
4
SuperPack worked for me (thanks, @Nolen) on OS X 10.8 (Mountain Lion) w/ XCode 4.5.1 installed.
SuperPack为我(谢谢,@Nolen)在OS X 10.8 (Mountain Lion) w/ XCode 4.5.1中工作。
Numpy worked for me using pip install numpy
after step #1 below. But scipy would not install using pip. SuperPack fixed this.
Numpy在下面的步骤#1之后使用pip安装Numpy为我工作。但是scipy不会使用pip进行安装。SuperPack固定。
The only thing I did differently was to use HomeBrew to install Python as step #1, rather than download it manually.
我做的唯一不同的事情是使用HomeBrew将Python安装为步骤1,而不是手动下载。
-
Install Python (separate from version that comes with OS X 10.8)
安装Python(独立于OS X 10.8版本)
brew install python --framework --universal
- brew安装python——框架——通用
pushd /System/Library/Frameworks/Python.framework/Versions
- pushd /系统/图书馆/框架/ Python.framework /版本
sudo rm Current
- sudo rm当前
sudo ln -s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/Current
- sudo ln - s /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework /版本/电流
popd
- popd
-
Install SuperPack:
安装SuperPack:
curl -o install_superpack.sh https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
- curl - o install_superpack。sh https://raw.github.com/fonnesbeck/ScipySuperpack/master/install_superpack.sh
sh install_superpack.sh
- sh install_superpack.sh
- (type your admin password several times during the installation...)
- (在安装过程中多次输入管理密码…)