gpt4 book ai didi

python - circleci:pip install dlib 失败

转载 作者:行者123 更新时间:2023-12-04 19:10:10 37 4
gpt4 key购买 nike

我有一个需要 dlib 的 python 项目.我正在尝试设置 CircleCI 并写了我的 config.yml如下:

# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
# use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers`
- image: circleci/python:3.6.1

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4

working_directory: ~/repo

steps:
- checkout

# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "requirements.txt" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run:
name: install dlib
command: |
sudo apt-get update
sudo apt-get install build-essential cmake pkg-config
sudo apt-get install libatlas-base-dev
sudo apt-get install libgtk-3-dev libboost-python-dev
sudo apt-get install libopenblas-dev liblapack-dev
sudo apt-get install libboost-all-dev
sudo apt-get install libx11-dev libgtk-3-dev
sudo apt-get install python python-dev python-pip
sudo apt-get install python3 python3-dev python3-pip

- run:
name: install dependencies
command: |
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt

- save_cache:
paths:
- ./venv
key: v1-dependencies-{{ checksum "requirements.txt" }}

requirements.txtdlib里面。但是,当我将它推送到 GitHub 以运行 CI 时,我收到以下错误:
Command "/home/circleci/repo/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-v87eln0u/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-gpf75fsu-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/circleci/repo/venv/include/site/python3.6/dlib" failed with error code 1 in /tmp/pip-build-v87eln0u/dlib/

这是回溯:
    Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-v87eln0u/dlib/setup.py", line 261, in <module>
'Topic :: Software Development',
File "/home/circleci/repo/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/usr/local/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/local/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/home/circleci/repo/venv/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/local/lib/python3.6/distutils/command/install.py", line 545, in run
self.run_command('build')
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/usr/local/lib/python3.6/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/usr/local/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/local/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-build-v87eln0u/dlib/setup.py", line 135, in run
self.build_extension(ext)
File "/tmp/pip-build-v87eln0u/dlib/setup.py", line 175, in build_extension
subprocess.check_call(cmake_build, cwd=build_folder)
File "/usr/local/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j34']' returned non-zero exit status 2.

看来我没有为 dlib 正确设置 linux 环境才能安装成功。我在这里想念什么?如何使用 dlib 运行 CircleCI在 python 上正确配置?

最佳答案

您可以使用 conda 环境安装 dlib(python 3.6 到 3.7.0 正常工作)。

先创建环境, conda create -n env_name python=版本

然后激活, conda 激活 env_name

现在通过 conda forge channel 安装, conda install -c conda-forge dlib=19.17

关于python - circleci:pip install dlib 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57948431/

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com