2017-07-24 158 views
0

在安裝一些Python包我收到一個錯誤說:安裝Python-pyxattr 17.04

[email protected]:~/bin/python/Stitch/build/reqs# pip install -r lnx_requirements.txt 
The directory '/home/baal/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
The directory '/home/baal/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. 
Requirement already satisfied: colorama==0.3.7 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 1)) 
Requirement already satisfied: email==4.0.2 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 2)) 
Requirement already satisfied: logging==0.4.9.6 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 3)) 
Requirement already satisfied: pexpect==4.2.1 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 4)) 
Requirement already satisfied: pycrypto==2.6.1 in /usr/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 5)) 
Requirement already satisfied: PyInstaller==3.2 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 6)) 
Requirement already satisfied: python-dateutil==2.5.3 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 7)) 
Requirement already satisfied: python-xlib==0.18 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 8)) 
Requirement already satisfied: pyudev==0.15 in /usr/local/lib/python2.7/dist-packages (from -r lnx_requirements.txt (line 9)) 
Collecting pyxattr==0.5.1 (from -r lnx_requirements.txt (line 10)) 
    Downloading pyxattr-0.5.1.tar.gz 
Collecting pyreadline==2.1 (from -r lnx_requirements.txt (line 11)) 
    Downloading pyreadline-2.1.zip (109kB) 
    100% |████████████████████████████████| 112kB 754kB/s 
Collecting readline==6.2.4.1 (from -r lnx_requirements.txt (line 12)) 
    Downloading readline-6.2.4.1.tar.gz (2.3MB) 
    100% |████████████████████████████████| 2.3MB 252kB/s 
Collecting requests==2.12.2 (from -r lnx_requirements.txt (line 13)) 
    Downloading requests-2.12.2-py2.py3-none-any.whl (575kB) 
    100% |████████████████████████████████| 583kB 588kB/s 
Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python2.7/dist-packages (from pexpect==4.2.1->-r lnx_requirements.txt (line 4)) 
Requirement already satisfied: setuptools in /usr/lib/python2.7/dist-packages (from PyInstaller==3.2->-r lnx_requirements.txt (line 6)) 
Requirement already satisfied: six>=1.5 in /home/baal/.local/lib/python2.7/site-packages (from python-dateutil==2.5.3->-r lnx_requirements.txt (line 7)) 
Installing collected packages: pyxattr, pyreadline, readline, requests 
    Running setup.py install for pyxattr ... error 
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xaAsqW/pyxattr/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-AFlKzP-record/install-record.txt --single-version-externally-managed --compile: 
    running install 
    running build 
    running build_ext 
    building 'xattr' extension 
    creating build 
    creating build/temp.linux-x86_64-2.7 
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-ZZaKJ6/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_XATTR_VERSION="0.5.1" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="[email protected]" -I/usr/include/python2.7 -c xattr.c -o build/temp.linux-x86_64-2.7/xattr.o 
    xattr.c:25:24: fatal error: attr/xattr.h: No such file or directory 
    #include <attr/xattr.h> 
          ^
    compilation terminated. 
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 

    ---------------------------------------- 
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-xaAsqW/pyxattr/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-AFlKzP-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-xaAsqW/pyxattr/ 
[email protected]:~/bin/python/Stitch/build/reqs# 

我試着安裝pyxattr

$ sudo apt-get update 
$ sudo apt-get install python-pyxattr 

而且我仍然得到即使安裝成功後也會發生同樣的問題。我清除了安裝並再次嘗試,仍是同樣的問題。有沒有安裝我不知道的技巧,如何在Ubuntu 17.04上成功安裝python-pyxattr

回答

0

安裝libattr1-dev的

apt-get install libattr1-dev 
+0

只能在7分鐘內接受工作謝謝 – owasp