mac安装pymssql遇见的问题

mac安装pymssql可以直接在终端运行: pip install pymssql

Jason-MacBook-Pro:~ wangying$ pip install pymssql
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting pymssql
  Downloading http://mirrors.aliyun.com/pypi/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz (691 kB)
     |████████████████████████████████| 691 kB 3.9 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-4ndcppo8/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-4ndcppo8/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-pip-egg-info-djzidp6h
         cwd: /private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-4ndcppo8/pymssql/
    Complete output (7 lines):
    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py:45: DistDeprecationWarning: Do not call this function
      warnings.warn("Do not call this function", DistDeprecationWarning)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-4ndcppo8/pymssql/setup.py", line 88, in <module>
        from Cython.Distutils import build_ext as _build_ext
    ModuleNotFoundError: No module named 'Cython'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

这里要注意错误提示在这里:ModuleNotFoundError: No module named 'Cython'

意思是缺少:Cython 库

Jason-MacBook-Pro:~ wangying$ pip install cython
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting cython
  Downloading http://mirrors.aliyun.com/pypi/packages/a4/87/d7431a94c7c438af66a91d63089be82cf0a5cb924fe2f74197c539f03568/Cython-0.29.20-cp37-cp37m-macosx_10_9_x86_64.whl (1.9 MB)
     |████████████████████████████████| 1.9 MB 3.4 MB/s 
Installing collected packages: cython
Successfully installed cython-0.29.20

接下来再次尝试:pip install pymssql

Jason-MacBook-Pro:~ wangying$ pip install pymssql
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting pymssql
  Downloading http://mirrors.aliyun.com/pypi/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz (691 kB)
     |████████████████████████████████| 691 kB 2.6 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-jugml9po/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-jugml9po/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-pip-egg-info-uu2axsnf
         cwd: /private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-jugml9po/pymssql/
    Complete output (53 lines):
    WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
    ERROR: Could not find a version that satisfies the requirement setuptools_git (from versions: none)
    ERROR: No matching distribution found for setuptools_git
    /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py:44: DistDeprecationWarning: Do not call this function
      warnings.warn("Do not call this function", DistDeprecationWarning)
    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py", line 363, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/tmprqncvacr', '--quiet', 'setuptools_git']' returned non-zero exit status 1.
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/pip-install-jugml9po/pymssql/setup.py", line 482, in <module>
        ext_modules = ext_modules(),
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 163, in setup
        _install_setup_requires(attrs)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/__init__.py", line 158, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py", line 698, in fetch_build_eggs
        replace_conflicting=True,
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 782, in resolve
        replace_conflicting=replace_conflicting
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1065, in best_match
        return self.obtain(req, installer)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1077, in obtain
        return installer(requirement)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/var/folders/qn/tx7b6pr11ggfsw1ynzl24ntr0000gn/T/tmprqncvacr', '--quiet', 'setuptools_git']' returned non-zero exit status 1.
    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 = ['/usr/local/include']
    setup.py: library_dirs = ['/usr/local/lib']
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

这里需要注意,别人有提示:

       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

还需安装FreeTDS库,接下继续安装:

Jason-MacBook-Pro:~ wangying$ brew install freetds
Error: Another active Homebrew update process is already in progress.
Please wait for it to finish or terminate it to continue.
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_2.high_sierra
==> Downloading from https://akamai.bintray.com/60/60c7d86f9364e166846f8d3fb2ba9
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.7.high_sierra.
==> Downloading from https://akamai.bintray.com/0b/0b30b166c0e6bbd9df375a018d0f2
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/freetds-1.1.42.high_sierra.
==> Downloading from https://akamai.bintray.com/bd/bd498b68beba699326bb17fb2e4c5
######################################################################## 100.0%
==> Installing dependencies for freetds: libtool and unixodbc
==> Installing freetds dependency: libtool
==> Pouring libtool-2.4.6_2.high_sierra.bottle.tar.gz
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺  /usr/local/Cellar/libtool/2.4.6_2: 71 files, 3.7MB
==> Installing freetds dependency: unixodbc
==> Pouring unixodbc-2.3.7.high_sierra.bottle.1.tar.gz
🍺  /usr/local/Cellar/unixodbc/2.3.7: 46 files, 1.8MB
==> Installing freetds
==> Pouring freetds-1.1.42.high_sierra.bottle.tar.gz
🍺  /usr/local/Cellar/freetds/1.1.42: 66 files, 3.5MB
==> Caveats
==> libtool
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.

接下来继续安装pip install setuptools

还有pip install setuptools-git

在下来安装pip install pymssql即可安装成功

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值