pip is showing error 'lsb_release -a' returned non-zero exit status 1

前端 未结 10 863
迷失自我
迷失自我 2020-12-10 01:00

I am trying to install packages using pip and it is throwing error.

Command that I have used,

sudo pip install selenium

The error

相关标签:
10条回答
  • 2020-12-10 01:57

    Ahhh the classic lsb_release issue. I have battled this problem many times. The issue is that your default Python implementation is trying to use Python 3 but lsb_release requires Python 2. To fix this problem do the following:

    • Open /usr/bin/lsb_release (Make sure you use sudo or open as root!)
    • Edit the first line to be #! /usr/bin/python2.7
    • Save the file

    now you can use pip again and everything should be fine.

    UPDATE May 2019: Newer versions of Linux are shipping with Python3 by default. As noted in the comments here, you may just need to use a specific version of Python 3.

    0 讨论(0)
  • 2020-12-10 01:57

    After installing python from source on Debian-9 (I did install those packages however) I had the same issue. This is how I solved it:

    /usr/local/bin/python3.x -m venv <my_venv>
    . <my_venv>/bin/activate
    easy_install pip
    easy_install setuptools
    easy_install wheel
    pip install -U setuptools wheel pip
    
    0 讨论(0)
  • 2020-12-10 01:57

    The solution for this issue is to update the shebang on the /usr/bin/lsb_release

    The shebang on this lsb_release file tells which version of python to use. This has to match with the current version of python you using.

    For instance, I'm using Python 3.5 so I'd change the shebang to be:

    #!/usr/bin/python3.5 -Es
    

    And get it working.

    0 讨论(0)
  • 2020-12-10 01:59

    I was able to fix this error message with unset _PYTHON_SYSCONFIGDATA_NAME. This prevented lsb_release from trying to import $_PYTHON_SYSCONFIGDATA_NAME. After that, pip install worked again. This fix applies if you run lsb_release -a and get ModuleNotFoundError: No module named '_sysconfigdata_x86_64_conda_cos6_linux_gnu'.

    0 讨论(0)
提交回复
热议问题