在安装了 Sql Server 的 Ubuntu 16.04 上出现 Pyodbc 安装错误 [英] Pyodbc installation error on Ubuntu 16.04 with Sql Server installed
问题描述
我正在尝试测试用于将数据从 mssql-server
迁移到 oracle server
的脚本.为此,我必须为 Ubuntu 安装 pyodbc
python
包,它具有 unixodbc
的依赖项.当我尝试使用以下方法安装 unixodbc-dev
时:
I am trying to test my scripts for data migration from mssql-server
to oracle server
. For this, I have to install pyodbc
python
package for Ubuntu, it has the dependency of unixodbc
. When I try to install unixodbc-dev
using:
sudo apt-get install unixodbc-dev
它给出了损坏的包错误:
The following packages have unmet dependencies:
unixodbc-dev : Depends: unixodbc (= 2.3.1-4.1)
Depends: odbcinst1debian2 (= 2.3.1-4.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
但是使用aptitude(sudo aptitude install unixodbc-dev
),它安装并且还删除了一些SQL服务器文件 由于我的 SQL-server
出现故障.
But with aptitude (sudo aptitude install unixodbc-dev
) it is installing and also removing some SQL server files due to which my SQL-server
goes down.
再次使用以下命令安装SQL server
:
Again on installing SQL server
with this command:
sudo apt-get install mssql-server mssql-tools -y
它删除了unixodbc
:
Removing unixodbc-dev (2.3.1-4.1) ...
Removing unixodbc (2.3.1-4.1) ...
Removing libodbc1:amd64 (2.3.1-4.1) ...
Removing odbcinst (2.3.1-4.1) ...
Removing odbcinst1debian2:amd64 (2.3.1-4.1) ...
因此,我只剩下 SQL-server
和 没有 unixodbc
(pyodbc 不起作用).我知道这两个包之间存在一些依赖性问题.
Hence again, I am left only with SQL-server
and no unixodbc
(pyodbc doesn't works). I understand that there is some dependency issue between both of the packages.
有没有办法将两者安装在同一台机器上,或者我必须在这里使用两台机器?
Is there is a way to Install both on the same machine or do I have to use 2 machines here?
推荐答案
最后,我从 仅限微软网站.以下是在 Ubuntu 16.04
上使用 mssql 设置 unixodbc
的方法:
Finally, I've got the solution from Microsoft's website only.
Here is the method for setting up unixodbc
with mssql on Ubuntu 16.04
:
sudo apt-get install unixodbc-dev-utf16
在此之后,我可以轻松地安装 pyodbc
:
After this, I can easily install pyodbc
with:
pip install pyodbc
此微软网页上列出了方法 用于使用和安装 Microsoft ODBC Driver
for SQL Server
适用于流行的 Linux 系统.
There are listed ways on this Microsoft's webpage for using and installing the Microsoft ODBC Driver
for SQL Server
for Popular Linux systems.
这是我发现的 Ubuntu 16.04
上最简单的安装方法:
Here is the easiest installation method for on Ubuntu 16.04
that I've found:
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql mssql-tools
sudo apt-get install unixodbc-dev-utf16 #this step is optional but recommended*
这篇关于在安装了 Sql Server 的 Ubuntu 16.04 上出现 Pyodbc 安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!