2016-11-20 61 views
3

我有這個錯誤一年了,仍然無法找到解決方案。我正在使用Linux Mint 17.3每當我嘗試使用pip安裝某些東西時,都會遇到一些異常情況。Python pip在Linux上不起作用薄荷

$ pip install -U scikit-learns 
Exception: 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 215, in main 
    status = self.run(options, args) 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/commands/install.py", line 272, in run 
    with self._build_session(options) as session: 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 72, in _build_session 
    insecure_hosts=options.trusted_hosts, 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 329, in __init__ 
    self.headers["User-Agent"] = user_agent() 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 93, in user_agent 
    from pip._vendor import distro 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 1050, in <module> 
    _distro = LinuxDistribution() 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 594, in __init__ 
    if include_lsb else {} 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 933, in _get_lsb_release_info 
    raise subprocess.CalledProcessError(code, cmd, stdout) 
CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1 
Traceback (most recent call last): 
    File "/usr/local/bin/pip", line 9, in <module> 
    load_entry_point('pip==9.0.1', 'console_scripts', 'pip')() 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/__init__.py", line 233, in main 
    return command.main(cmd_args) 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 251, in main 
    timeout=min(5, options.timeout)) as session: 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/basecommand.py", line 72, in _build_session 
    insecure_hosts=options.trusted_hosts, 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 329, in __init__ 
    self.headers["User-Agent"] = user_agent() 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/download.py", line 93, in user_agent 
    from pip._vendor import distro 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 1050, in <module> 
    _distro = LinuxDistribution() 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 594, in __init__ 
    if include_lsb else {} 
    File "/usr/local/lib/python2.7/dist-packages/pip-9.0.1-py2.7.egg/pip/_vendor/distro.py", line 933, in _get_lsb_release_info 
    raise subprocess.CalledProcessError(code, cmd, stdout) 
subprocess.CalledProcessError: Command 'lsb_release -a' returned non-zero exit status 1 

總是彈出「命令'lsb_release -a'返回非零退出狀態1」。我已經安裝了多個版本的python,並嘗試手動刪除它們,它仍然出現相同的錯誤。

如果你不能幫我解決這個錯誤,我該如何卸載所有的python文件?

+2

你用sudo試過了嗎?它可以解決令人驚訝的數量問題。 – Will

+0

這很奇怪。 'lsb_release -a'是否可以工作? – Goyo

+0

我失去了耐心,只是決定重新安裝整個操作系統,現在沒有任何問題。自從我好奇這是什麼問題之後,我會放棄這一點。 – Dobob

回答

0

當我更新Python和點子,我有過這樣 問題您可以運行lsb_release,如果您運行shell:#lsb_release

它的工作,如:

Traceback (most recent call last): File "/usr/bin/lsb_release", line 28, in import lsb_release ImportError: No module named 'lsb_release'

您可以更改文件(/usr/bin/lsb_release)所以

#! /usr/bin/python -Es 

到:

012從家當變化
#! /usr/bin/python2 -Es 

其中您指定路徑/usr/bin/python2舊的Python二進制文件。