擅长:python、mysql、java
<p>因为Python2已经过了它的生命周期,所以Python2的几个包都包含在20.04中。您必须手动为Python 2安装<code>pip</code>:</p>
<p>首先,安装Python 2:</p>
<pre><code>sudo apt install python2
</code></pre>
<p>然后,使用<code>python2</code>跟随<a href="https://pip.pypa.io/en/stable/installing/" rel="noreferrer">https://pip.pypa.io/en/stable/installing/</a>:</p>
<pre><code>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python2 get-pip.py
</code></pre>
<p>您可以使用<code>sudo</code>运行第二步。如果不使用<code>sudo</code>,则需要按照安装消息的建议更改<code>PATH</code>。或者,也可能更好(因为它不会改变<code>PATH</code>),使用</p>
<pre><code>python2 -m pip
</code></pre>
<p>只要你需要pip2</p>