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

前端 未结 10 862
迷失自我
迷失自我 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:41

    After installing python3.7.3 and changing the symbolic link of python3 to point to it, I had this error. Fixed it by changing first line to:

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

    The original was almost that... had to add the ".5" only.

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

    I had to uninstall python3-dev and python2.7-dev on a conflict between miniconda-installed python3.4 and my python3.6 compiled from source on a Raspberry pi (Raspbian Stretch with Arm71) and then reinstall pip and pip3:

    sudo apt-get -y remove python2.7-dev python3-dev
    wget https://bootstrap.pypa.io/get-pip.py
    sudo python get-pip.py
    sudo python3 get-pip.py
    
    0 讨论(0)
  • 2020-12-10 01:44

    I had the same problem on a shared hosting account which is very limiting (I was installing python and pip for my user only). Their lsb_release -a returns something non-standard and I cannot change it. I solved the issue by editing distro.py (in your case: /usr/local/lib/python2.7/dist-packages/pip/_vendor/distro.py) and changing the default parameter of __init__ method. In my version it was at the line 545. Snippet:

    def __init__(self,
        include_lsb=True,
        os_release_file='',
        distro_release_file=''):
    

    Just change include_lsb=True to include_lsb=False.

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

    I saw the same error and sudo rm /usr/bin/lsb_release resolved it for me.

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

    I think this is a problem with old compiled python files that clash with an Ubuntu upgrade.

    To me, the solution was to delete the following .pyc files

    sudo rm /usr/lib/python2.7/dist-packages/*.pyc
    
    0 讨论(0)
  • 2020-12-10 01:56

    In short, it was solved doing this:

    $ sudo ln -s /usr/share/pyshared/lsb_release.py /usr/local/lib/python3.8/site-packages/lsb_release.py
    

    Details:

    When trying $ sudo pip3 install something I had the error referred in this thread:

    ... a long traceback, and ... 
    subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
    

    It started to happen after updating from python 3.5 to 3.8. I have tried several solutions without success. A clue for the solution came when executing $ lsb_release -a which gave me the following error:

    Traceback (most recent call last):
      File "/usr/bin/lsb_release", line 25, in <module>
        import lsb_release
    ModuleNotFoundError: No module named 'lsb_release'
    

    This other error message led me to this solution which is explaining that from version 3.6 python has no lsb_release.py file any more. The solution is just creating a link for this missing file.

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