在 Ubuntu 11.10 的 virtualenv 中安装“numpy”
Posted
技术标签:
【中文标题】在 Ubuntu 11.10 的 virtualenv 中安装“numpy”【英文标题】:Installing `numpy` within a virtualenv in Ubuntu 11.10 【发布时间】:2012-05-17 16:56:42 【问题描述】:使用easy_install numpy
安装numpy
时出现以下异常,有人可以帮忙吗?无论我使用pip
还是easy_install
,我都遇到了同样的问题。很难理解出了什么问题。
non-existing path in 'numpy/core': 'build/src.linux-x86_64-2.7/numpy/core/src/multiarray'
non-existing path in 'numpy/core': 'build/src.linux-x86_64-2.7/numpy/core/src/umath'
numpy/core/src/multiarray/scalartypes.c.src:2549:1: warning: ‘longlong_arrtype_hash’ defined but not used [-Wunused-function]
numpy/core/src/multiarray/mapping.c:74:1: warning: ‘_array_ass_item’ defined but not used [-Wunused-function]
build/src.linux-x86_64-2.7/numpy/core/include/numpy/__ufunc_api.h:226:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
numpy/core/src/multiarray/scalartypes.c.src:2549:1: warning: ‘longlong_arrtype_hash’ defined but not used [-Wunused-function]
numpy/core/src/multiarray/mapping.c:74:1: warning: ‘_array_ass_item’ defined but not used [-Wunused-function]
build/src.linux-x86_64-2.7/numpy/core/include/numpy/__ufunc_api.h:226:1: warning: ‘_import_umath’ defined but not used [-Wunused-function]
gcc: internal compiler error: Killed (program cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.6/README.Bugs> for instructions.
error: Setup script exited with error: Command "gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Inumpy/core/include -Ibuild/src.linux-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/include -I/usr/include/python2.7 -Ibuild/src.linux-x86_64-2.7/numpy/core/src/multiarray -Ibuild/src.linux-x86_64-2.7/numpy/core/src/umath -c numpy/core/src/multiarray/multiarraymodule_onefile.c -o build/temp.linux-x86_64-2.7/numpy/core/src/multiarray/multiarraymodule_onefile.o" failed with exit status 4
/tmp/easy_install-l43x51/numpy-1.6.1/numpy/distutils/misc_util.py:252: RuntimeWarning: Parent module 'numpy.distutils' not found while handling absolute import
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/tmp/easy_install-l43x51/numpy-1.6.1/numpy/distutils/misc_util.py", line 252, in clean_up_temporary_directory
ImportError: No module named numpy.distutils
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/tmp/easy_install-l43x51/numpy-1.6.1/numpy/distutils/misc_util.py", line 252, in clean_up_temporary_directory
ImportError: No module named numpy.distutils
【问题讨论】:
我认为gcc: internal compiler error: Killed (program cc1)
是关键。看来您需要提交错误报告。
我只是做了一个apt-get upgrade gcc
,现在一切正常。谢谢。
@hilau 你能把它添加到答案中吗?
【参考方案1】:
也许 GCC 没有更新。我刚刚做了一个apt-get upgrade gcc
和numpy
编译成功。
【讨论】:
你最终使用了哪个版本的 gcc?我有 gcc 4.6.3,但仍然看到错误。【参考方案2】:您只需要使用此命令而不是 easy_install。为我工作
sudo apt-get install python-numpy python-scipy
【讨论】:
谢谢。我通常在virtualenv
中安装包,所以在开发多个项目时不会污染全局命名空间。首选easy_install
。
apt-get install
不会在 virtualenv 中安装包。我不想污染全球环境。
-1 建议的答案与 virtualenv 相关的问题不符,virtualenv 的目的是管理与全局(系统)包分离的包的不同 virsions。以上是关于在 Ubuntu 11.10 的 virtualenv 中安装“numpy”的主要内容,如果未能解决你的问题,请参考以下文章
在 ubuntu 11.10 上安装 GCC 4.3.4 时出错