CentOS7下pip安装dlib失败 c++: interna

2019-06-21  本文已影响0人  liuxingzi

我使用virtualenv 多环境来安装
requirements.tx 文件

cmake >=3.14.0
opencv-python >= 4.1.0.25
dlib >= 19.9.0

进入到虚拟环境中执行

pip install -r requirements.txt

其中安装 dlib时出错

   ERROR: Complete output from command /var/local/www/HelloWorld/.env/bin/python3.7 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-1worr3fc/dlib/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-f0_rr9_y/install-record.txt --single-version-externally-managed --compile --install-headers /var/local/www/HelloWorld/.env/include/site/python3.7/dlib:
    ERROR: running install
    running build
    running build_py
    package init file 'dlib/__init__.py' not found (or not a regular file)
    running build_ext
    Building extension for Python 3.7.3 (default, Jun  6 2019, 13:22:27)

中间省略

 c++: internal compiler error: Killed (program cc1plus)
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <http://bugzilla.redhat.com/bugzilla> for instructions.
    gmake[2]: *** [CMakeFiles/dlib_python.dir/src/vector.cpp.o] Error 4
    gmake[1]: *** [CMakeFiles/dlib_python.dir/all] Error 2
    gmake: *** [all] Error 2

红了一大片呀
出错信息也挺多的,google了半天,
有说没装cmake 、boost的其实不是,最后在一篇文章 cpp项目编译时报错: c++: internal compiler error: Killed 中找到答案,没想到呀,居然是内存不够[汗]

执行下面方法吧

[root@iZrj931hn8rgs8397tuz5mZ build]# dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
1000+0 records in
1000+0 records out
1048576000 bytes (1.0 GB) copied, 2.34565 s, 447 MB/s
[root@iZrj931hn8rgs8397tuz5mZ build]# free -m
              total        used        free      shared  buff/cache   available
Mem:           3790         101        2546           0        1142        3454
Swap:             0           0           0
[root@iZrj931hn8rgs8397tuz5mZ build]# mkswap /var/swap.img
Setting up swapspace version 1, size = 1023996 KiB
no label, UUID=99a90e95-ee16-45f7-801d-71378b1a7551
[root@iZrj931hn8rgs8397tuz5mZ build]# swapon /var/swap.img

增加了交换空间,再执行

pip install dlib

终于成功了,不敢相信眼睛了,搞了半天了。

(.env) [root@VM_0_5_centos XXX]# pip install dlib
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Collecting dlib
  Downloading http://mirrors.tencentyun.com/pypi/packages/05/57/e8a8caa3c89a27f80bc78da39c423e2553f482a3705adc619176a3a24b36/dlib-19.17.0.tar.gz (3.4MB)
     |████████████████████████████████| 3.4MB 774kB/s
Building wheels for collected packages: dlib
  Building wheel for dlib (setup.py) ... done
  Stored in directory: /root/.cache/pip/wheels/60/86/17/867f7bfbd71b4dcd589300e3cbdb76e2c6ef9c0ca2aba55560
Successfully built dlib
Installing collected packages: dlib
Successfully installed dlib-19.17.0
上一篇下一篇

猜你喜欢

热点阅读