python-3.x - Numpy 1.11 未安装在 virtualenv @ Ubuntu Studio 中

标签 python-3.x numpy ubuntu pip virtualenv

我在 4.15.0-23-lowlatency #25-Ubuntu 上设置了 Python 3 virtualenv。
在 virtualenv 中我安装了 numpy1.14。我想安装 numpy1.11。
我收到错误:

numpy/core/src/multiarray/numpyos.c:18:10: fatal error: xlocale.h: No such file or directory
   #include <xlocale.h>
            ^~~~~~~~~~~
  compilation terminated.
  numpy/core/src/multiarray/numpyos.c:18:10: fatal error: xlocale.h: No such file or directory
   #include <xlocale.h>
            ^~~~~~~~~~~
  compilation terminated.
  error: Command "x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.6-EKG1lX/python3.6-3.6.5=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DHAVE_NPY_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Inumpy/core/include -Ibuild/src.linux-x86_64-3.6/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/include/python3.6m -I/home/kujaw/.virtualenvs/coursera_audio3/include/python3.6m -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -Ibuild/src.linux-x86_64-3.6/numpy/core/src/private -c numpy/core/src/multiarray/numpyos.c -o build/temp.linux-x86_64-3.6/numpy/core/src/multiarray/numpyos.o" failed with exit status 1

我找到了创建符号链接(symbolic link)的解决方法:

ln -s /usr/include/locale.h /usr/include/xlocale.h

但它不起作用。有人可以为此提供正确的解决方案吗?

最佳答案

存在适用于您的平台的预构建二进制包,您应该可以通过 wheel 安装它:

pip install wheel  
pip install numpy==1.11.*

根据 this commit,如果您有某些理由改为从源代码构建包, 我认为最好是

ln -s /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h /usr/include/xlocale.h

关于python-3.x - Numpy 1.11 未安装在 virtualenv @ Ubuntu Studio 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51041109/

相关文章:

python - Pandas 设置多级列索引

python - 在Python中读取npy数据文件并导出为文本文件

ruby - 使用 shell 配置更新 Vagrant 中的路径

从c文件调用rrd_create

python - 如何让 Flask 默认使用 Python 3

Python 2 和 3 兼容的使用键和值迭代字典的方式

python - 无法导入 seaborn

python - 使用 cx_freeze 编译 python3 和 pyqt4 时出现问题

python - 正则表达式提取嵌套模式

Ubuntu 上的 Mysql : ERROR 1045 (28000)