我已尝试安装SQL Server命令行工具,但收到下一个错误
sql-tools unixodbc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
mssql-tools is already the newest version (17.6.1.1-1).
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
unixodbc-dev : Depends: unixodbc (= 2.3.7)
Depends: odbcinst1debian2 (= 2.3.7) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.我尝试使用sudo apt install msodbcsql17和sudo apt-get install unixodbc,但使用第二个命令得到了类似的错误。
发布于 2021-06-03 13:02:43
根据问题中的版本号,您似乎从微软的Install tools on Ubuntu 16.04文档中运行了以下curl命令:
$ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 79 100 79 0 0 163 0 --:--:-- --:--:-- --:--:-- 163
deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main如果您在Ubuntu20.04上执行此操作,则apt-get install将失败,并显示以下错误:
$ sudo apt-get install -y mssql-tools unixodbc-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
unixodbc-dev : Depends: unixodbc (= 2.3.7) but it is not going to be installed
Depends: odbcinst1debian2 (= 2.3.7) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.根据文档,您需要更改资源库URL中的版本号以匹配您的Ubuntu版本,因此在Ubuntu18.04上使用以下curl命令:
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list以及Ubuntu20.04上的以下curl命令:
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list在下载正确的存储库参考并执行apt-get update之后,apt-get install命令应该成功完成。
https://stackoverflow.com/questions/65472806
复制相似问题