本文共 3031 字,大约阅读时间需要 10 分钟。
报错的内容如下:
Collecting pymssql Using cached https://files.pythonhosted.org/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz ERROR: Complete output from command python setup.py egg_info: ERROR: /usr/local/lib/python3.7/site-packages/setuptools/dist.py:46: DistDeprecationWarning: Do not call this function warnings.warn(“Do not call this function”, DistDeprecationWarning) Traceback (most recent call last): File “”, line 1, in File “/private/var/folders/2s/k44kn91x32gdprpz8qxpg_7r0000gn/T/pip-install-zriyazsw/pymssql/setup.py”, line 88, in from Cython.Distutils import build_ext as _build_ext ModuleNotFoundError: No module named ‘Cython’ ---------------------------------------- ERROR: Command “python setup.py egg_info” failed with error code 1 in /private/var/folders/2s/k44kn91x32gdprpz8qxpg_7r0000gn/T/pip-install-zriyazsw/pymssql/
解决的办法如下:
xhj@localhost:~/Documents $ pip3 install Cython Collecting Cython Downloading https://files.pythonhosted.org/packages/62/13/2ed2e2005afb114ffe08fbd25d890e3795ca86cebf11c97ff8877da58f28/Cython-0.29.13-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (2.9MB) |████████████████████████████████| 2.9MB 57kB/s Installing collected packages: CythonSuccessfully installed Cython-0.29.13xhj@localhost:~/Documents $ pip3 install pymysqlCollecting pymysql Using cached https://files.pythonhosted.org/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whlInstalling collected packages: pymysqlSuccessfully installed pymysql-0.9.3
出现的原因:
1、因为里面说我缺少Cython库,所以按照提示安装后,再执行安装pymysql就可以了2、我一开始下载的不是pymasql 是pymssql,暂时还没弄明白两者的区别,只是听python开发说常用的是pymysql 所以就换了
xhj@localhost:~ $ pip install pymssqlzsh: command not found: pipxhj@localhost:~ $ python3 Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24) [Clang 6.0 (clang-600.0.57)] on darwinType "help", "copyright", "credits" or "license" for more information.>>> pip install pymssql File "", line 1 pip install pymssql ^SyntaxError: invalid syntax>>> KeyboardInterrupt>>> exitUse exit() or Ctrl-D (i.e. EOF) to exit>>> exitUse exit() or Ctrl-D (i.e. EOF) to exit>>> exit() File " ", line 1 exit() ^SyntaxError: invalid character in identifier>>> exit()xhj@localhost:~ $ pip --versionzsh: command not found: pip
出于小白,我曾尝试在python内使用pip命令,也尝试在外部使用命令,但是都报错,然后我想我后面自己装了一个python3 ,所以尝试用pip3来执行一下,果然被我搞对了
xhj@localhost:~/Documents/py/dw_monitor (master) $ pip3 --version 2 ↵pip 19.1.1 from /usr/local/lib/python3.7/site-packages/pip (python 3.7)xhj@localhost:~/Documents/py/dw_monitor (master) $ pip3 install pymssql
转载地址:http://virki.baihongyu.com/