在 mac osx 上使用 pypy 安装 numpy
Installing numpy with pypy on mac osx
我无法在 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
有谁知道我做错了什么,我该如何解决?
NumPy 正在移植到 pypy,因此目前只有一个实验版本可用。根据官方网站,将那个版本的 NumPy 安装到 pypy 的命令是:
pypy -m pip install git+https://bitbucket.org/pypy/numpy.git
http://pypy.org/download.html#installing-numpy
您尝试的命令可能会尝试从尚未为 pypy 准备好的 PyPI 安装普通 NumPy。
(编辑)
我只是按照 https://bitbucket.org/pypy/numpy 给出的说明进行操作,我可以在 Linux Mint 17 上安装 numpy 1.9.0 到 pypy。
基本上为 pypy-numpy
创建一个新环境
virtualenv -p /path/to/pypy/bin/pypy /directory/to/try/pypy-numpy
/path/to/pypy/bin/pypy
这里是你的 PyPy 4.0.1 的路径。
/directory/to/try/pypy-numpy
由你决定。我创建于 home/pypy-numpy
然后我通过
克隆了 NumPyPy 源
git clone https://bitbucket.org/pypy/numpy.git
然后我移动到这个克隆目录 'numpy' 并做了
git checkout pypy-4.0.1
这获取了 PyPy 4.0.1 所需的 NumPyPy 版本
现在我可以
~/pypy-numpy/bin/pypy setup.py install
工作没有问题。
希望这对 Mac 也有帮助。
我无法在 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
有谁知道我做错了什么,我该如何解决?
NumPy 正在移植到 pypy,因此目前只有一个实验版本可用。根据官方网站,将那个版本的 NumPy 安装到 pypy 的命令是:
pypy -m pip install git+https://bitbucket.org/pypy/numpy.git
http://pypy.org/download.html#installing-numpy
您尝试的命令可能会尝试从尚未为 pypy 准备好的 PyPI 安装普通 NumPy。
(编辑)
我只是按照 https://bitbucket.org/pypy/numpy 给出的说明进行操作,我可以在 Linux Mint 17 上安装 numpy 1.9.0 到 pypy。
基本上为 pypy-numpy
创建一个新环境virtualenv -p /path/to/pypy/bin/pypy /directory/to/try/pypy-numpy
/path/to/pypy/bin/pypy
这里是你的 PyPy 4.0.1 的路径。
/directory/to/try/pypy-numpy
由你决定。我创建于 home/pypy-numpy
然后我通过
克隆了 NumPyPy 源git clone https://bitbucket.org/pypy/numpy.git
然后我移动到这个克隆目录 'numpy' 并做了
git checkout pypy-4.0.1
这获取了 PyPy 4.0.1 所需的 NumPyPy 版本
现在我可以
~/pypy-numpy/bin/pypy setup.py install
工作没有问题。
希望这对 Mac 也有帮助。