在 Google Colab 中安装需求时获取"Command errored out with exit status 1: python setup.py egg_info"



从语音情感识别库的需求.txt文件安装时,我在 Colab 笔记本中收到错误。

首先,我正在克隆用于语音情感识别的Github项目:

git clone https://github.com/marcogdepinto/Django-Emotion-Classification-Ravdess-API.git

然后使用以下代码安装要求

%pip install utils
%cd /content/Django-Emotion-Classification-Ravdess-API
%pip install -r requirements.txt

然后显示以下错误:

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我到处搜索,但找不到任何解决方案。

你在这里别无选择,你需要查看日志或更详细的pip install输出。

尝试详细的点选项:

!pip install -vvv -r requirements.txt

在该错误消息的末尾,您将看到实际问题:

Error: pg_config executable not found.
pg_config is required to build psycopg2 from source.  Please add the directory
containing pg_config to the $PATH or specify the full executable path with the
option:
python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.
If you prefer to avoid building psycopg2 from source, please install the PyPI
'psycopg2-binary' package instead.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).

您需要安装pg_config.

这篇相关文章(未找到可执行文件pg_config(提供了如何基于平台执行此操作的选项。由于Google Colab运行在基于Linux/Ubuntu的操作系统上:

!apt install libpq-dev

请注意!而不是%

测试一下:

!pg_config --version
PostgreSQL 10.10 (Ubuntu 10.10-0ubuntu0.18.04.1)

然后重复安装:

%pip install -r requirements.txt

Google Colab 将要求您在安装完成后重新启动运行时。这样做。然后,您可以再次进行安装,以确认">已满足要求:">

请注意,虽然安装成功,但有一些警告表明 Django-Emotion-Classification-Ravdess-API 可能需要与 Colab 的预安装库不兼容的软件包(在 requirements.txt 中(。

相关内容

最新更新