pip3安装scipy时出现编译错误

2024-04-19 01:25:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要安装scipy。然而,经过大约5-7分钟的编译,我在Ubuntu 14.04.3 LTS上得到了以下错误:

sudo pip3 install scipy
...
error: Command "x86_64-linux-gnu-g++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -D__STDC_FORMAT_MACROS=1 -Iscipy/sparse/sparsetools -I/usr/local/lib/python3.4/dist-packages/numpy/core/include -I/usr/include/python3.4m -c scipy/sparse/sparsetools/csc.cxx -o build/temp.linux-x86_64-3.4/scipy/sparse/sparsetools/csc.o" failed with exit status 4

In file included from /usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1777:0,

                 from /usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/ndarrayobject.h:18,

                 from scipy/sparse/sparsetools/sparsetools.h:5,

                 from scipy/sparse/sparsetools/csc.cxx:4:

/usr/local/lib/python3.4/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]

 #warning "Using deprecated NumPy API, disable it by " \

  ^

x86_64-linux-gnu-g++: internal compiler error: Killed (program cc1plus)

Please submit a full bug report,

with preprocessed source if appropriate.

See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.

----------------------------------------
Cleaning up...
Command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-e3q7ek8f-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/scipy
Storing debug log for failure in /home/ubuntu/.pip/pip.log

有人知道怎么解决这个问题吗?在


Tags: pipfromcorenumpyapiincludelibpackages
2条回答

您的numpy似乎是使用发行版包管理器安装的(即通过运行apt-get install python3-numpy),因为numpy包位于python libs的dist-packages目录中。你为什么不这样安装scipy呢?你可以跑了

sudo apt-get install python3-scipy

如果您想使用pip,我建议在^{}实例(或者更好的是^{})中安装包,以避免此类冲突。否则,您应该使用pip的系统范围版本,而不是用户安装的pip(输出显示您的pip属于用户ubuntu),因此您可以先使用apt-get安装它,然后确保使用这个新pip来安装scipy。在

安装setuptools使我在ubuntu14.04上工作

相关问题 更多 >