命令'pip install Somepackage'在Ubuntu 20.04上不起作用

时间:2020-10-15 16:20:38

标签: python python-3.x linux pip ubuntu-20.04

我已安装 Ubuntu 20.04 。 我已经安装了python3.8python3-pip。 但是执行pip install SomePackage时出现此错误。

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 11, in <module>
    load_entry_point('pip==7.1.0', 'console_scripts', 'pip')()
  File "/usr/local/lib/python3.8/dist-packages/pip-7.1.0-py3.8.egg/pip/__init__.py", line 217, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python3.8/dist-packages/pip-7.1.0-py3.8.egg/pip/basecommand.py", line 216, in main
    with self._build_session(
  File "/usr/local/lib/python3.8/dist-packages/pip-7.1.0-py3.8.egg/pip/basecommand.py", line 68, in _build_session
    session = PipSession(
  File "/usr/local/lib/python3.8/dist-packages/pip-7.1.0-py3.8.egg/pip/download.py", line 316, in __init__
    self.headers["User-Agent"] = user_agent()
  File "/usr/local/lib/python3.8/dist-packages/pip-7.1.0-py3.8.egg/pip/download.py", line 92, in user_agent
    zip(["name", "version", "id"], platform.linux_distribution()),
AttributeError: module 'platform' has no attribute 'linux_distribution'

1 个答案:

答案 0 :(得分:0)

您正在使用python3.x.x。这就是为什么您应该使用pip3。

尝试这样:

<html lang="en_US" dir="LTR" style="--dlgMW:500px; --dlgW:50%; --dlgMH:0px; --dlgH:80%;">
    <head>
        <link rel="stylesheet" href="main.css">
        <title></title>
    </head>
    <body>
        <div class="editor">
            <div class="dialog show">
                <div class="window">
                    <div class="frame">
                        <div class="body">
                            <div class="content">
                                <h2>Switch Series</h2>
                                <div class="scroll">
                                    <ol id="series_list">
                                        <li class="series">
                                            <span class="series_title">Create New Series</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Main Timeline</span>
                                        </li>

                                        <!-- For testing scroll behavior -->
                                        <li class="series">
                                            <span class="series_title">Custom series 1</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 2</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 3</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 4</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 5</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 6</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 7</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 8</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 9</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 10</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 11</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 12</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 13</span>
                                        </li>
                                        <li class="series">
                                            <span class="series_title">Custom series 14</span>
                                        </li>
                                    </ol>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>

如果未加载pip3,请使用此选项:

pip3 install SomePackage

您还可以使用以下方法进行更新:

sudo apt install python3-pip