安装 pymssql 和 cython 在 Mac OSX 上失败

install pymssql and cython fails on Mac OSX

我有 python 个项目。在项目中我有 requirements.txt 文件。在尝试从需求文件安装依赖项时出现以下错误。我正在使用 mac machine, python 3.6, Cython==0.29.3,pymssql==2.1.4

ERROR: Command errored out with exit status 1:
 command: /Users/user_name/.virtualenvs/test/bin/python3.6 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/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 pip-egg-info
     cwd: /private/var/folders/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/pymssql/
Complete output (7 lines):
/Users/user_name/.virtualenvs/test/lib/python3.6/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/rz/f3lsfyh154s_r7fggcqx57q80000gp/T/pip-install-bz2kcaud/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.

能看懂下面的步骤,

brew install freetds

然后尝试安装 requirements.txt 文件。 如果仍然出现错误,请按照 。 .以下步骤。

pip install cython
pip install pymssql

然后再次尝试安装 requirements.txt 文件。