错误::您必须在sources.list中放置一些“源”URI
我正在尝试在ubuntu上安装PIL python模块
我首先需要使用以下命令安装一个名为python-imaging的包
sudo apt-get build-dep python-imaging
当我尝试这样做时,我得到了错误
E: You must put some 'source' URIs in your sources.list
我看到这个问题,显示如何通过GUI修复,但我正在使用命令行。 有谁知道我怎么能解决这个错误..?
更新:根据以下答案,我已更新我的包列表,但我现在收到此错误。 不确定它是否相关,如果不是,我会开始一个新问题,因为我无法在任何地方找到对错误的引用。
E: Build-Depends dependency for python-imaging cannot be satisfied because candidate version of package python-all-dev can't satisfy version requirements
16.10运行software-properties-gtk
然后在“Ubuntu软件”选项卡下单击“源代码”:
这在/etc/apt/sources.list
下添加了一些deb-src
行,现在我可以做sudo apt-get build-dep
。
我知道你没有问过GUI,但有时devs只是不支持它…但是你总是可以用这种方法做差异并稍后再应用它。
您可以直接编辑源列表( /etc/apt/sources.list
)。 我认为您需要添加/取消注释这些行:
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted #Added by software-properties deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty restricted main universe multiverse #Added by software-properties deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-updates restricted main universe multiverse #Added by software-properties deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse #Added by software-properties deb-src http://security.ubuntu.com/ubuntu trusty-security restricted main universe multiverse #Added by software-properties deb-src http://gb.archive.ubuntu.com/ubuntu/ trusty-proposed restricted main universe multiverse #Added by software-properties
我通过禁用源代码选项,保存sources.list文件的一个副本,然后启用源代码选项,保存另一个副本,然后在两者上运行diff
问题。
您可能想要更改前缀http://gb.
到列表中其他源的前缀(因此它使用最近的repo镜像),您也可以忽略#Added by software-properties
。
在编辑sources.list
,在尝试再次安装之前运行sudo apt-get update
。
完整的diff
可以在这里找到
另一种方法是生成一个新的方法。 获取完整sources.list的一种方法是使用此站点: https : //repogen.simplylinux.ch/
编辑/etc/apt/sources.list
sudo nano /etc/apt/sources.list
删除#或添加deb-src $ url行。 $ url =一条生长线
例
deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted
deb blah blah
deb-src完全相同等等等等
有关其他信息,请参阅https://help.ubuntu.com/community/Repositories/CommandLine 。
对于Ubuntu 16.04,我成功地对sources.list进行了这些更新:
$ sudo diff /etc/apt/sources.list /etc/apt/sources.list.bkp 6c6 < deb-src http://au.archive.ubuntu.com/ubuntu/ xenial main restricted --- > # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial main restricted 19c19 < deb-src http://au.archive.ubuntu.com/ubuntu/ xenial universe --- > # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial universe 39c9 < deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse --- > # deb-src http://au.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse 53c53 < deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse --- > # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
在Linux Mint(我在版本18中),您可以转到软件源 (在开始菜单中搜索它或从具有software-sources
的终端打开它)。 在第一个选项卡上,您将找到一个复选框启用源代码存储库 。 如果启用此function,程序会将正确的行放入/etc/apt/sources.list.d/official-source-repositories.list
文件中。 在此之后,不要忘记sudo apt-get update
(或点击更新软件源中的缓存 )。
这是命令行解决方案
cat /etc/apt/sources.list | grep deb-src # see what will get changed
上面cmd的典型输出
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic universe # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates universe # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates multiverse # deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse # deb-src http://archive.canonical.com/ubuntu bionic partner # deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted # deb-src http://security.ubuntu.com/ubuntu bionic-security universe # deb-src http://archive.ubuntu.com/ubuntu bionic main universe restricted multiverse # deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse
如果你正好改变线条,在新的ubuntu安装上总是如此,那么发出:
sudo sed -i~orig -e 's/# deb-src/deb-src/' /etc/apt/sources.list
它会对输入文件进行备份,然后搜索注释掉的deb-src,删除注释以使这些行处于活动状态…刷新本地元数据后,将让您的机器了解ubuntu软件包的新类别
sudo apt-get update
现在再次发出你失败的原始命令:
E: You must put some 'source' URIs in your sources.list