我无法在mac上用pypy安装numpy。我使用brew安装了pypy,当我尝试执行时:
pip_pypy install numpy
我收到此错误:
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/numpy
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/numpy/_build_utils
creating build/temp.macosx-10.11-x86_64-2.7/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/numpy/_build_utils/src
compile options: '-DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/Cellar/pypy/4.0.1/libexec/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -c'
extra options: '-msse3 -I/System/Library/Frameworks/vecLib.framework/Headers'
cc: numpy/core/src/multiarray/alloc.c
In file included from numpy/core/src/multiarray/alloc.c:8:
In file included from numpy/core/include/numpy/arrayobject.h:4:
In file included from numpy/core/include/numpy/ndarrayobject.h:27:
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:28:12: error: visibility does not match previous declaration
extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
^
numpy/core/include/numpy/ndarraytypes.h:10:31: note: expanded from macro 'NPY_NO_EXPORT'
#define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
^
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/_numpyconfig.h:25:46: note: expanded from macro 'NPY_VISIBILITY_HIDDEN'
#define NPY_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pypy_decl.h:611:1: note: previous attribute is here
PyAPI_DATA(PyTypeObject) PyArray_Type;
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:15:35: note: expanded from macro 'PyAPI_DATA'
# define PyAPI_DATA(RTYPE) extern PyAPI_FUNC(RTYPE)
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:14:43: note: expanded from macro 'PyAPI_FUNC'
# define PyAPI_FUNC(RTYPE) __attribute__((visibility("default"))) RTYPE
^
numpy/core/src/multiarray/alloc.c:109:30: error: use of undeclared identifier 'PyMem_MALLOC'
&PyArray_malloc);
^
numpy/core/include/numpy/ndarraytypes.h:335:24: note: expanded from macro 'PyArray_malloc'
#define PyArray_malloc PyMem_Malloc
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pymem.h:8:22: note: expanded from macro 'PyMem_Malloc'
#define PyMem_Malloc PyMem_MALLOC
^
2 errors generated.
In file included from numpy/core/src/multiarray/alloc.c:8:
In file included from numpy/core/include/numpy/arrayobject.h:4:
In file included from numpy/core/include/numpy/ndarrayobject.h:27:
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/__multiarray_api.h:28:12: error: visibility does not match previous declaration
extern NPY_NO_EXPORT PyTypeObject PyArray_Type;
^
numpy/core/include/numpy/ndarraytypes.h:10:31: note: expanded from macro 'NPY_NO_EXPORT'
#define NPY_NO_EXPORT NPY_VISIBILITY_HIDDEN
^
build/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy/_numpyconfig.h:25:46: note: expanded from macro 'NPY_VISIBILITY_HIDDEN'
#define NPY_VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pypy_decl.h:611:1: note: previous attribute is here
PyAPI_DATA(PyTypeObject) PyArray_Type;
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:15:35: note: expanded from macro 'PyAPI_DATA'
# define PyAPI_DATA(RTYPE) extern PyAPI_FUNC(RTYPE)
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/Python.h:14:43: note: expanded from macro 'PyAPI_FUNC'
# define PyAPI_FUNC(RTYPE) __attribute__((visibility("default"))) RTYPE
^
numpy/core/src/multiarray/alloc.c:109:30: error: use of undeclared identifier 'PyMem_MALLOC'
&PyArray_malloc);
^
numpy/core/include/numpy/ndarraytypes.h:335:24: note: expanded from macro 'PyArray_malloc'
#define PyArray_malloc PyMem_Malloc
^
/usr/local/Cellar/pypy/4.0.1/libexec/include/pymem.h:8:22: note: expanded from macro 'PyMem_Malloc'
#define PyMem_Malloc PyMem_MALLOC
^
2 errors generated.
error: Command "cc -arch x86_64 -O2 -fPIC -Wimplicit -O2 -fPIC -Wimplicit -O2 -fPIC -Wimplicit -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DNO_ATLAS_INFO=3 -DHAVE_CBLAS -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Inumpy/core/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/usr/local/Cellar/pypy/4.0.1/libexec/include -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -Ibuild/src.macosx-10.11-x86_64-2.7/numpy/core/src/private -c numpy/core/src/multiarray/alloc.c -o build/temp.macosx-10.11-x86_64-2.7/numpy/core/src/multiarray/alloc.o -msse3 -I/System/Library/Frameworks/vecLib.framework/Headers" failed with exit status 1
----------------------------------------
Command "/usr/local/Cellar/pypy/4.0.1/bin/pypy -u -c "import setuptools, tokenize;__file__='/private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-fCQrIA-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-build-RBCHFE/numpy
当我尝试按照http://pypy.org/download.html的说明进行操作时 关于pypy版本4.1,我得到了更多令人困惑的错误:
Cloning https://bitbucket.org/pypy/numpy.git to /var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-59hKzA-build
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-59hKzA-build/setup.py", line 33, in <module>
('.'.join(map(str, MIN_PYPY_VERSION)),))
RuntimeError: PyPy version >= 4.1 required
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /var/folders/9p/_t441dx15ddcx5ycrjxrxmyh0000gn/T/pip-59hKzA-build
任何人都知道我做错了什么以及如何解决?
答案 0 :(得分:4)
NumPy正被移植到pypy,所以现在只有一个实验版本。根据官方网站,将该版本的NumPy安装到pypy的命令是:
virtualenv -p /path/to/pypy/bin/pypy /directory/to/try/pypy-numpy
http://pypy.org/download.html#installing-numpy
您尝试过的命令可能会尝试从PyPI安装普通的NumPy,而PPIy还没有准备就绪。
(编辑)
我只是按照https://bitbucket.org/pypy/numpy给出的说明操作,我可以在Linux Mint 17上安装numpy 1.9.0到pypy。
基本上为pypy-numpy创建一个新的env
/path/to/pypy/bin/pypy
/directory/to/try/pypy-numpy
这是PyPy 4.0.1的路径。
git clone https://bitbucket.org/pypy/numpy.git
取决于你。我在home / pypy-numpy中创建了
然后我通过
克隆了NumPyPy源代码 git checkout pypy-4.0.1
然后我转移到这个克隆目录'numpy'并做了
~/pypy-numpy/bin/pypy setup.py install
这为PyPy 4.0.1提供了我们需要的NumPyPy版本
现在我可以
<div ng-repeat="w in row.widgets" class="col-md-{{12/row.widgets.length}}">
<widget-directive-one ng-if="$index==0"></widget-directive-one>
<widget-directive-two ng-if="$index==1"></widget-directive-two>
<widget-directive-three ng-if="$index==2"></widget-directive-three>
</div>
没有问题。
希望这对Mac也有帮助。