首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Ubuntu 20上安装mssql-tools和unixodbc-dev

在Ubuntu 20上安装mssql-tools和unixodbc-dev
EN

Stack Overflow用户
提问于 2020-12-28 11:47:52
回答 1查看 249关注 0票数 0

我已尝试安装SQL Server命令行工具,但收到下一个错误

代码语言:javascript
复制
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 msodbcsql17sudo apt-get install unixodbc,但使用第二个命令得到了类似的错误。

EN

回答 1

Stack Overflow用户

发布于 2021-06-03 13:02:43

根据问题中的版本号,您似乎从微软的Install tools on Ubuntu 16.04文档中运行了以下curl命令:

代码语言:javascript
复制
$ 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将失败,并显示以下错误:

代码语言:javascript
复制
$ 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命令:

代码语言:javascript
复制
curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

以及Ubuntu20.04上的以下curl命令:

代码语言:javascript
复制
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命令应该成功完成。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65472806

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档