Retinanet网络的安装问题:error: command 'gcc' failed with exit status 1的解决办法

一:安装步骤

  • 1.打开Git,克隆retinanet代码到本地:
git clone https://github.com/fizyr/keras-retinanet.git
  • 2.在当前存储目录下keras-retinanet-master中,执行:
pip3 install . --user

NOTE:由于自定义安装tensorflow,这个软件包并没有定义对tensorflow相应的依赖关系,因为它会尝试安装tensorflow(至少在Arch Linux会导致错)。 请确保tensorflow按照个人的系统要求进行安装。 另外,确保安装Keras 2.2.0或更高版本。注意:pip2 install . --user,针对的是python2版本。第2步目的是为了后面导入包 import keras_resnet等不报错。比如找不到 compute_overlap函数的问题。

  • 3.如果相对COCO数据集进行测试,需要安装pycocotools,命令如下:
pip3 install --user git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI

也可以从官网下载COCOAPI代码,自己用命令行安装。

git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
make

Windows系统和Linux系统下pycocotools的安装方法参见下面:

  • Windows下pycocotools的安装————–传送门

  • Linux下pycocotools的安装————–传送门


问题:

在进行第2步安装时,在目录keras-retinanet-master下执行以下代码:

nkdx@nkdx:~/shuyu/keras-retinanet-master$ pip3 install . --user

出现了如下错误:

Processing /home/nkdx/shuyu/keras-retinanet-master
Requirement already satisfied: keras in /home/nkdx/anaconda3/lib/python3.5/site-packages (from keras-retinanet==0.4.1) (2.1.5)
Requirement already satisfied: keras-resnet in /home/nkdx/.local/lib/python3.5/site-packages (from keras-retinanet==0.4.1) (0.1.0)
Requirement already satisfied: six in /home/nkdx/anaconda3/lib/python3.5/site-packages (from keras-retinanet==0.4.1) (1.11.0)
Requirement already satisfied: scipy in /home/nkdx/anaconda3/lib/python3.5/site-packages (from keras-retinanet==0.4.1) (1.0.0)
Requirement already satisfied: cython in /home/nkdx/anaconda3/lib/python3.5/site-packages (from keras-retinanet==0.4.1) (0.27.3)
Requirement already satisfied: pyyaml in /home/nkdx/anaconda3/lib/python3.5/site-packages (from keras->keras-retinanet==0.4.1) (3.12)
Requirement already satisfied: numpy>=1.9.1 in /home/nkdx/anaconda3/lib/python3.5/site-packages (from keras->keras-retinanet==0.4.1) (1.14.3)
Building wheels for collected packages: keras-retinanet
  Running setup.py bdist_wheel for keras-retinanet ... error
  Complete output from command /home/nkdx/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-rfhv874f/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-3o8jcs_m --python-tag cp35:
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.5
  creating build/lib.linux-x86_64-3.5/tests
  copying tests/test_losses.py -> build/lib.linux-x86_64-3.5/tests
  copying tests/__init__.py -> build/lib.linux-x86_64-3.5/tests
  creating build/lib.linux-x86_64-3.5/keras_retinanet
  copying keras_retinanet/losses.py -> build/lib.linux-x86_64-3.5/keras_retinanet
  copying keras_retinanet/initializers.py -> build/lib.linux-x86_64-3.5/keras_retinanet
  copying keras_retinanet/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet
  creating build/lib.linux-x86_64-3.5/tests/backend
  copying tests/backend/test_common.py -> build/lib.linux-x86_64-3.5/tests/backend
  copying tests/backend/__init__.py -> build/lib.linux-x86_64-3.5/tests/backend
  creating build/lib.linux-x86_64-3.5/tests/utils
  copying tests/utils/test_transform.py -> build/lib.linux-x86_64-3.5/tests/utils
  copying tests/utils/__init__.py -> build/lib.linux-x86_64-3.5/tests/utils
  creating build/lib.linux-x86_64-3.5/tests/preprocessing
  copying tests/preprocessing/test_generator.py -> build/lib.linux-x86_64-3.5/tests/preprocessing
  copying tests/preprocessing/test_csv_generator.py -> build/lib.linux-x86_64-3.5/tests/preprocessing
  copying tests/preprocessing/__init__.py -> build/lib.linux-x86_64-3.5/tests/preprocessing
  creating build/lib.linux-x86_64-3.5/tests/layers
  copying tests/layers/test_misc.py -> build/lib.linux-x86_64-3.5/tests/layers
  copying tests/layers/test_filter_detections.py -> build/lib.linux-x86_64-3.5/tests/layers
  copying tests/layers/__init__.py -> build/lib.linux-x86_64-3.5/tests/layers
  creating build/lib.linux-x86_64-3.5/tests/models
  copying tests/models/test_densenet.py -> build/lib.linux-x86_64-3.5/tests/models
  copying tests/models/test_mobilenet.py -> build/lib.linux-x86_64-3.5/tests/models
  copying tests/models/__init__.py -> build/lib.linux-x86_64-3.5/tests/models
  creating build/lib.linux-x86_64-3.5/keras_retinanet/backend
  copying keras_retinanet/backend/cntk_backend.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
  copying keras_retinanet/backend/tensorflow_backend.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
  copying keras_retinanet/backend/common.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
  copying keras_retinanet/backend/dynamic.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
  copying keras_retinanet/backend/theano_backend.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
  copying keras_retinanet/backend/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
  creating build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/keras_version.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/coco_eval.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/colors.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/visualization.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/eval.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/model.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/transform.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/anchors.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/image.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  copying keras_retinanet/utils/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
  creating build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
  copying keras_retinanet/callbacks/eval.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
  copying keras_retinanet/callbacks/common.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
  copying keras_retinanet/callbacks/coco.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
  copying keras_retinanet/callbacks/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
  creating build/lib.linux-x86_64-3.5/keras_retinanet/bin
  copying keras_retinanet/bin/debug.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
  copying keras_retinanet/bin/train.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
  copying keras_retinanet/bin/evaluate.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
  copying keras_retinanet/bin/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
  copying keras_retinanet/bin/convert_model.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
  creating build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/csv_generator.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/pascal_voc.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/open_images.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/kitti.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/coco.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  copying keras_retinanet/preprocessing/generator.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
  creating build/lib.linux-x86_64-3.5/keras_retinanet/layers
  copying keras_retinanet/layers/_misc.py -> build/lib.linux-x86_64-3.5/keras_retinanet/layers
  copying keras_retinanet/layers/filter_detections.py -> build/lib.linux-x86_64-3.5/keras_retinanet/layers
  copying keras_retinanet/layers/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/layers
  creating build/lib.linux-x86_64-3.5/keras_retinanet/models
  copying keras_retinanet/models/densenet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
  copying keras_retinanet/models/retinanet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
  copying keras_retinanet/models/mobilenet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
  copying keras_retinanet/models/vgg.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
  copying keras_retinanet/models/resnet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
  copying keras_retinanet/models/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
  running build_ext
  cythoning keras_retinanet/utils/compute_overlap.pyx to keras_retinanet/utils/compute_overlap.c
  building 'keras_retinanet.utils.compute_overlap' extension
  creating build/temp.linux-x86_64-3.5
  creating build/temp.linux-x86_64-3.5/keras_retinanet
  creating build/temp.linux-x86_64-3.5/keras_retinanet/utils
  gcc -pthread -B /home/nkdx/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/home/nkdx/anaconda3/include/python3.5m -c keras_retinanet/utils/compute_overlap.c -o build/temp.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.o
  In file included from /home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816:0,
                   from /home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                   from /home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                   from keras_retinanet/utils/compute_overlap.c:567:
  /home/nkdx/anaconda3/lib/python3.5/site-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 " \
    ^
  gcc -pthread -shared -L/home/nkdx/anaconda3/lib -B /home/nkdx/anaconda3/compiler_compat -Wl,-rpath=/home/nkdx/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.o -o build/lib.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.cpython-35m-x86_64-linux-gnu.so
  /home/nkdx/anaconda3/compiler_compat/ld: cannot find -lpthread
  /home/nkdx/anaconda3/compiler_compat/ld: cannot find -lc
  collect2: error: ld returned 1 exit status
  error: command 'gcc' failed with exit status 1

  ----------------------------------------
  Failed building wheel for keras-retinanet
  Running setup.py clean for keras-retinanet
Failed to build keras-retinanet
Installing collected packages: keras-retinanet
  Running setup.py install for keras-retinanet ... error
    Complete output from command /home/nkdx/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-rfhv874f/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-09fwld2k/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.5
    creating build/lib.linux-x86_64-3.5/tests
    copying tests/test_losses.py -> build/lib.linux-x86_64-3.5/tests
    copying tests/__init__.py -> build/lib.linux-x86_64-3.5/tests
    creating build/lib.linux-x86_64-3.5/keras_retinanet
    copying keras_retinanet/losses.py -> build/lib.linux-x86_64-3.5/keras_retinanet
    copying keras_retinanet/initializers.py -> build/lib.linux-x86_64-3.5/keras_retinanet
    copying keras_retinanet/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet
    creating build/lib.linux-x86_64-3.5/tests/backend
    copying tests/backend/test_common.py -> build/lib.linux-x86_64-3.5/tests/backend
    copying tests/backend/__init__.py -> build/lib.linux-x86_64-3.5/tests/backend
    creating build/lib.linux-x86_64-3.5/tests/utils
    copying tests/utils/test_transform.py -> build/lib.linux-x86_64-3.5/tests/utils
    copying tests/utils/__init__.py -> build/lib.linux-x86_64-3.5/tests/utils
    creating build/lib.linux-x86_64-3.5/tests/preprocessing
    copying tests/preprocessing/test_generator.py -> build/lib.linux-x86_64-3.5/tests/preprocessing
    copying tests/preprocessing/test_csv_generator.py -> build/lib.linux-x86_64-3.5/tests/preprocessing
    copying tests/preprocessing/__init__.py -> build/lib.linux-x86_64-3.5/tests/preprocessing
    creating build/lib.linux-x86_64-3.5/tests/layers
    copying tests/layers/test_misc.py -> build/lib.linux-x86_64-3.5/tests/layers
    copying tests/layers/test_filter_detections.py -> build/lib.linux-x86_64-3.5/tests/layers
    copying tests/layers/__init__.py -> build/lib.linux-x86_64-3.5/tests/layers
    creating build/lib.linux-x86_64-3.5/tests/models
    copying tests/models/test_densenet.py -> build/lib.linux-x86_64-3.5/tests/models
    copying tests/models/test_mobilenet.py -> build/lib.linux-x86_64-3.5/tests/models
    copying tests/models/__init__.py -> build/lib.linux-x86_64-3.5/tests/models
    creating build/lib.linux-x86_64-3.5/keras_retinanet/backend
    copying keras_retinanet/backend/cntk_backend.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
    copying keras_retinanet/backend/tensorflow_backend.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
    copying keras_retinanet/backend/common.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
    copying keras_retinanet/backend/dynamic.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
    copying keras_retinanet/backend/theano_backend.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
    copying keras_retinanet/backend/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/backend
    creating build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/keras_version.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/coco_eval.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/colors.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/visualization.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/eval.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/model.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/transform.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/anchors.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/image.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    copying keras_retinanet/utils/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/utils
    creating build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
    copying keras_retinanet/callbacks/eval.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
    copying keras_retinanet/callbacks/common.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
    copying keras_retinanet/callbacks/coco.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
    copying keras_retinanet/callbacks/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/callbacks
    creating build/lib.linux-x86_64-3.5/keras_retinanet/bin
    copying keras_retinanet/bin/debug.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
    copying keras_retinanet/bin/train.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
    copying keras_retinanet/bin/evaluate.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
    copying keras_retinanet/bin/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
    copying keras_retinanet/bin/convert_model.py -> build/lib.linux-x86_64-3.5/keras_retinanet/bin
    creating build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/csv_generator.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/pascal_voc.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/open_images.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/kitti.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/coco.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    copying keras_retinanet/preprocessing/generator.py -> build/lib.linux-x86_64-3.5/keras_retinanet/preprocessing
    creating build/lib.linux-x86_64-3.5/keras_retinanet/layers
    copying keras_retinanet/layers/_misc.py -> build/lib.linux-x86_64-3.5/keras_retinanet/layers
    copying keras_retinanet/layers/filter_detections.py -> build/lib.linux-x86_64-3.5/keras_retinanet/layers
    copying keras_retinanet/layers/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/layers
    creating build/lib.linux-x86_64-3.5/keras_retinanet/models
    copying keras_retinanet/models/densenet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
    copying keras_retinanet/models/retinanet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
    copying keras_retinanet/models/mobilenet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
    copying keras_retinanet/models/vgg.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
    copying keras_retinanet/models/resnet.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
    copying keras_retinanet/models/__init__.py -> build/lib.linux-x86_64-3.5/keras_retinanet/models
    running build_ext
    skipping 'keras_retinanet/utils/compute_overlap.c' Cython extension (up-to-date)
    building 'keras_retinanet.utils.compute_overlap' extension
    creating build/temp.linux-x86_64-3.5
    creating build/temp.linux-x86_64-3.5/keras_retinanet
    creating build/temp.linux-x86_64-3.5/keras_retinanet/utils
    gcc -pthread -B /home/nkdx/anaconda3/compiler_compat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include -I/home/nkdx/anaconda3/include/python3.5m -c keras_retinanet/utils/compute_overlap.c -o build/temp.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.o
    In file included from /home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarraytypes.h:1816:0,
                     from /home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/ndarrayobject.h:18,
                     from /home/nkdx/anaconda3/lib/python3.5/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from keras_retinanet/utils/compute_overlap.c:567:
    /home/nkdx/anaconda3/lib/python3.5/site-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 " \
      ^
    gcc -pthread -shared -L/home/nkdx/anaconda3/lib -B /home/nkdx/anaconda3/compiler_compat -Wl,-rpath=/home/nkdx/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.o -o build/lib.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.cpython-35m-x86_64-linux-gnu.so
    /home/nkdx/anaconda3/compiler_compat/ld: cannot find -lpthread
    /home/nkdx/anaconda3/compiler_compat/ld: cannot find -lc
    collect2: error: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/nkdx/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-req-build-rfhv874f/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-09fwld2k/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-req-build-rfhv874f/`

可以看到问题主要在于:

/home/nkdx/anaconda3/compiler_compat/ld: cannot find -lpthread
/home/nkdx/anaconda3/compiler_compat/ld: cannot find -lc
collect2: error: ld returned 1 exit status
error: command 'gcc' failed with exit status 1

解决办法:找到libc.so和libpthread.so的相关软件并安装


关于cannot find -lxxx的问题参考这里


首先使用下面命令安装apt-file

apt-get install apt-file

然后更新缓存:

apt-file update

寻找缺失的库文件:这里我根据报错cannot find -lpthreadcannot find -lc寻找它们依赖的包

apt-file search libc.so # 以cannot find -lc为例

得到下图所示:
Retinanet网络的安装问题:error: command 'gcc' failed with exit status 1的解决办法_第1张图片
使用命令安装libc6-dev即可:

apt-get install libc6-dev

同理cannot find -lpthread的错误也可以这样解决,事实上libc.so和libpthread.so都在libc6.dev中。
报错中有一个信息是:

 gcc -pthread -shared -L/home/nkdx/anaconda3/lib -B /home/nkdx/anaconda3/compiler_compat -Wl,-rpath=/home/nkdx/anaconda3/lib,--no-as-needed build/temp.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.o -o build/lib.linux-x86_64-3.5/keras_retinanet/utils/compute_overlap.cpython-35m-x86_64-linux-gnu.so

可以发现在/home/nkdx/anaconda3/lib下没有找到libpthread.so文件,这里我们需要将上面找到的在/usr/lib/x86_64-linux-gnu/路径下的libpthread.solibc.so文件拷贝到/home/nkdx/anaconda3/lib下即可解决问题。

然后运行:

pip3 install . --user

当然也可以直接使用配置好的程序文件,这样可以一步到位无需进行复杂的配置或者担心出错,之后会将配置好的程序同步到博客中,也可以直接联系我的邮箱获取,我会及时回复。
邮箱:[email protected]

你可能感兴趣的:(系统配置,神经网络,工具使用)