• Lindenis V536学习记录


    (1)编译出错问题:

    subprocess.CalledProcessError: Command 'XXX' returned non-zero exit status 1.

    转载自:https://blog.csdn.net/u012114438/article/details/83578113

    ubuntu系统下,系统默认python2.7和python3.5,但需要使用更高的python版本的pip3时可能遇到的错误

    问题一:

    Traceback (most recent call last):
      File "/usr/bin/pip3", line 9, in <module>
        from pip import main
    ImportError: cannot import name 'main'

    解决办法:

    sudo vim /usr/bin/pip3

    修改:

    from pip import main
    if __name__ == '__main__':
        sys.exit(main())

    为:

    from pip import __main__
    if __name__ == '__main__':
        sys.exit(__main__._main())

    注意:单下划线和双下划线

    问题二:

    使用pip3安装任何模块时的类似报错:

    Traceback (most recent call last):
      File "/usr/bin/pip3", line 11, in <module>
        sys.exit(__main__._main())
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/__init__.py", line 246, in main
        return command.main(cmd_args)
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 264, in main
        timeout=min(5, options.timeout)) as session:
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 81, in _build_session
        insecure_hosts=options.trusted_hosts,
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/download.py", line 338, in __init__
        self.headers["User-Agent"] = user_agent()
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_internal/download.py", line 101, in user_agent
        zip(["name", "version", "id"], distro.linux_distribution()),
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 120, in linux_distribution
        return _distro.linux_distribution(full_distribution_name)
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 634, in linux_distribution
        self.version(),
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 688, in version
        self.lsb_release_attr('release'),
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 836, in lsb_release_attr
        return self._lsb_release_info.get(attribute, '')
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 522, in __get__
        ret = obj.__dict__[self._fname] = self._f(obj)
      File "/usr/bin/python3.6/lib/python3.6/site-packages/pip/_vendor/distro.py", line 933, in _lsb_release_info
        stdout = subprocess.check_output(cmd, stderr=devnull)
      File "/usr/bin/python3.6/lib/python3.6/subprocess.py", line 336, in check_output
        **kwargs).stdout
      File "/usr/bin/python3.6/lib/python3.6/subprocess.py", line 418, in run
        output=stdout, stderr=stderr)
    subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

    解决办法:

    sudo vim /usr/bin/lsb_release

    修改第一行,指明python的版本号,若安装的是python3.6则修改:

    #!/usr/bin/python3

    为:

    #!/usr/bin/python3.6

  • 相关阅读:
    P2024 [NOI2001]食物链[扩展域并查集]
    poj1733 Parity game[带权并查集or扩展域]
    BZOJ1079 [SCOI2008]着色方案[组合计数DP]
    P1801 黑匣子[对顶堆]
    poj3784 Running Median[对顶堆]
    P1196 [NOI2002]银河英雄传说[带权并查集]
    poj1456 Supermarket[另类的并查集做法]
    P1955 [NOI2015]程序自动分析[离散化+并查集]
    BZOJ1306 [CQOI2009]match循环赛/BZOJ3139 [Hnoi2013]比赛[dfs剪枝+细节题]
    android的模拟器-Genymotion
  • 原文地址:https://www.cnblogs.com/olivertian/p/16095295.html
Copyright © 2020-2023  润新知