安装python-prctl报错

Collecting python-prctl时候报错

 ERROR: Command errored out with exit status 1:
     command: /opt/conda/envs/vilbert-mt/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-6axqqvn7/python-prctl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-6axqqvn7/python-prctl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ip8ujaz7
         cwd: /tmp/pip-install-6axqqvn7/python-prctl/
    Complete output (1 lines):
    You need to install libcap development headers to build this module
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

结果显然是没有安装libcap development headers

于是我们找到python-prctl的安装文档https://pythonhosted.org/python-prctl/

在Ubuntu系统下输入

apt-get install build-essential libcap-dev

报错

Reading package lists... Done
Building dependency tree       
Reading state information... Done
N: Ignoring file 'nvidia-ml.list.backup' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
E: Unable to locate package libcap-dev

为解决该问题,输入

apt-get update

然后再次输入

apt-get install build-essential libcap-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4ubuntu1).
Suggested packages:
  manpages-dev
The following NEW packages will be installed:
  libcap-dev
0 upgraded, 1 newly installed, 0 to remove and 112 not upgraded.
Need to get 23.2 kB of archives.
After this operation, 95.2 kB of additional disk space will be used.
N: Ignoring file 'nvidia-ml.list.backup' in directory '/etc/apt/sources.list.d/' as it has an invalid filename extension
Do you want to continue? [Y/n] y
Get:1 https://mirrors.aliyun.com/ubuntu bionic/main amd64 libcap-dev amd64 1:2.25-1.2 [23.2 kB]
Fetched 23.2 kB in 1s (22.2 kB/s)      
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libcap-dev:amd64.
(Reading database ... 27366 files and directories currently installed.)
Preparing to unpack .../libcap-dev_1%3a2.25-1.2_amd64.deb ...
Unpacking libcap-dev:amd64 (1:2.25-1.2) ...
Setting up libcap-dev:amd64 (1:2.25-1.2) ...

成功

你可能感兴趣的:(安装,python,ubuntu,linux)