我在网上关注python教程,而我却这样做:
akclark@enceladus:~$ pip install virtualenv
但是我得到了以下内容:
Command 'pip' not found, but can be installed with:
sudo apt install python-pip
很容易,对吧?所以我尝试
akclark@enceladus:~$ sudo apt install python-pip
但我得到一个错误...
Reading package lists... Done
Building dependency tree Reading state information... Done
E: Unable to locate package python-pip
我究竟做错了什么?
编辑:每条评论我都尝试过 sudo apt update
EDIT2:我尝试apt-cache madison python-pip
并得到
N: Unable to locate package python-pip
EDIT3:grep '^deb ' /etc/apt/sources.list
显示
deb http://archive.ubuntu.com/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu bionic-security main
deb http://archive.ubuntu.com/ubuntu bionic-updates main
您必须启用universe
包含python-pip
软件包的类别。
如David所建议的,如果已software-properties-common
安装,则可以使用以下命令将universe
类别添加到源文件:
sudo add-apt-repository universe
然后:
sudo apt update
sudo apt install python-pip
但是,如果您希望手动添加它,或者您没有add-apt-repository
可运行的命令,请按照以下说明进行操作:
/etc/apt/sources.list
使用编辑器打开,例如nano
:
sudo nano /etc/apt/sources.list
然后universe
在每一行的末尾添加,如下所示:
deb http://archive.ubuntu.com/ubuntu bionic main universe
deb http://archive.ubuntu.com/ubuntu bionic-security main universe
deb http://archive.ubuntu.com/ubuntu bionic-updates main universe
按Ctrl+o保存文件。按Ctrl+x退出nano。
然后运行:
sudo apt update
最后:
sudo apt install python-pip
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句