无法使用pip安装pymssql并链接到使用Mac上的fink安装的FreeTDS

时间:2017-11-18 02:00:14

标签: python-3.x pip freetds pymssql

我在iMac上运行MacOS 10.11.6(El Capitan)。我已经建立了一个Python 3.4.7虚拟环境,并且我已经安装了pip(9.0.1)各种软件包,包括numpy,pandas,scipy等。但是,我在使用pymssql时遇到了困难。我知道我需要先安装FreeTDS,然后使用fink(安装了freetds版本0.91-5)完成了这项工作。但是,当我激活虚拟环境并运行时:

pip install pymssql

我收到以下错误消息(对其大小道歉):

Collecting pymssql
  Using cached pymssql-2.1.3.tar.gz
    Complete output from command python setup.py egg_info:
    Download error on https://pypi.python.org/simple/setuptools_git/: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) -- 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:600) -- 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:600) -- Some packages may not be found!
    No local packages or working download links found for setuptools_git
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/75/qtnqhywh8xj9760059b8dbd80000gq/T/pip-build-pyxahulz/pymssql/setup.py", line 477, in <module>
        ext_modules = ext_modules(),
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/setuptools/__init__.py", line 128, in setup
        _install_setup_requires(attrs)
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/setuptools/__init__.py", line 123, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/setuptools/dist.py", line 453, in fetch_build_eggs
        replace_conflicting=True,
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 866, in resolve
        replace_conflicting=replace_conflicting
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1146, in best_match
        return self.obtain(req, installer)
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/pkg_resources/__init__.py", line 1158, in obtain
        return installer(requirement)
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/setuptools/dist.py", line 520, in fetch_build_egg
        return cmd.easy_install(req)
      File "/Users/xyz/Documents/python_projects/general_python34_projects/env34/lib/python3.4/site-packages/setuptools/command/easy_install.py", line 666, in easy_install
        raise DistutilsError(msg)
    distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools_git')
    setup.py: platform.system() => 'Darwin'
    setup.py: platform.architecture() => ('64bit', '')
    setup.py: platform.libc_ver() => ('', '')
    setup.py: Detected Darwin/Mac OS X.
        You can install FreeTDS with Homebrew or MacPorts, or by downloading
        and compiling it yourself.

        Homebrew (http://brew.sh/)
        --------------------------
        brew install freetds

        MacPorts (http://www.macports.org/)
        -----------------------------------
        sudo port install freetds

    setup.py: Not using bundled FreeTDS
    setup.py: include_dirs = ['/sw/include']
    setup.py: library_dirs = ['/usr/local/lib', '/sw/lib', '/opt/local/lib']

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/75/qtnqhywh8xj9760059b8dbd80000gq/T/pip-build-pyxahulz/pymssql/

在线说明介绍如何使用Homebrew安装FreeTDS,但我总是使用fink而不想与两个系统安装的代码发生冲突。

我已经更新了fink和pip,并且我安装了最新的设置工具。

我尝试过跑步:

pip install --global-option=build_ext --global-option="-L/sw/lib" --global-option="-I/sw/include" pymssql

......但没有运气。

我已经尝试安装早期版本的pymssql:

pip install pymssql==2.1.1

再一次,没有快乐。

或者证书验证失败&#39;在错误开始时注释输出密钥?

我确定我以前在其他计算机上安装过MSSQL而且我不记得问题。我也不记得我做的不同(如果有的话)。

请有人帮我解决这个问题。

1 个答案:

答案 0 :(得分:0)

原始虚拟环境是使用已使用fink安装的Python 3.4.7创建的。

我最终删除了这个虚拟环境并使用从python.org下载的python 3.4.4重新创建了一个新的虚拟环境。重新安装了软件包(使用pip冻结),安装了pymssql,没有任何问题。

所以,虽然我还不知道是什么原因引起了问题,但至少我现在有了工作环境。