我有一个基于这个 docker 文件构建的 Docker Image 。 docker 映像带有一个 Ubuntu 14.04 的 Vagrant VM,我在 OSX 10.11.6 中运行它。Microsoft SQL Server 位于 aws-ec2 实例中。由于我的程序是用 Python 编写的,因此我尝试了 2 个用于连接数据库的 python 库,但每个库都以相同的方式失败。以下是迄今为止发生的情况的概述:
apk add freetds-dev
因为需要安装 FreeTDS 才能与 Microsoft SQL 数据库交互。pip install pymssql
并且pip install pyobdc
都失败并显示相同的错误消息:
{ bash-4.3# pip install pymssql
Collecting pymssql
Using cached pymssql-2.1.3.tar.gz
Complete output from command python setup.py egg_info:
setup.py: platform.system() => 'Linux'
Download error on https://pypi.python.org/simple/setuptools_git/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
Download error on https://pypi.python.org/simple/setuptools-git/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
Couldn't find index page for 'setuptools_git' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590) -- Some packages may not be found!
No local packages or download links found for setuptools-git
setup.py: platform.architecture() => ('64bit', '')
setup.py: platform.linux_distribution() => ('', '', '')
setup.py: platform.libc_ver() => ('', '')
setup.py: Not using bundled FreeTDS
setup.py: include_dirs = []
setup.py: library_dirs = ['/usr/local/lib']
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-macbkK/pymssql/setup.py", line 477, in <module>
ext_modules = ext_modules(),
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 268, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 313, in fetch_build_eggs
replace_conflicting=True,
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 846, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1091, in best_match
return self.obtain(req, installer)
File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1103, in obtain
return installer(requirement)
File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 380, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 633, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools-git')
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-macbkK/pymssql/
(与 相同的错误pyodbc
)当我尝试安装时setuptools-git
(如错误消息所述),出现gcc
编译错误。
除了尝试之外pip install...
,我还使用直接从 Alpine Linux 存储库下载了 SQLAlchemy 库apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/community/ py-sqlalchemy
,但安装仍然失败/python 库仍然失败。
我在 Alpine Linux 和 Microsoft SQL Server 上找到的文档很少,所以我想知道我是否遗漏了一些说它们不兼容的东西。有没有人尝试过这样做?如果不建议通过 Python 连接,我正在考虑通过 Shell 命令进行连接,任何人都可以为此建议最佳实践吗?
谢谢!