【昊鼎王五】pip安装pymssql模块时报错“PEP 517”怎么解决?

【昊鼎王五】pip安装pymssql模块时报错“PEP 517”怎么解决?

背景

https://blog.csdn.net/haoding205/article/details/103242102中已经讲到了如何安装pip工具,此篇就讲一个典型的安装第三方库时报错的解决方法。

报错信息

如下图:
在这里插入图片描述

[root@centos tmp]# pip3 install pymssql
Collecting pymssql
  Using cached https://files.pythonhosted.org/packages/4a/20/bcd4db9e7990b50e85280f0c9488c0a53f7e6bf9048203448d8e0f29a536/pymssql-3.0.3.tar.gz
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: pymssql
  Building wheel for pymssql (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/python3/bin/python3.7 /usr/local/python3/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmplktlmv2p
       cwd: /tmp/pip-install-6x1763de/pymssql
  Complete output (42 lines):
  running bdist_wheel
  running build
  installing to build/bdist.linux-x86_64/wheel
  running install
  /tmp/pip-build-env-b2tk6mrs/overlay/lib/python3.7/site-packages/setuptools/dist.py:46: DistDeprecationWarning: Do not call this function
    warnings.warn("Do not call this function", DistDeprecationWarning)
    ...(此处略去1000+字)
File "/usr/local/python3/lib/python3.7/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/local/python3/lib/python3.7/distutils/dist.py", line 985, in run_command
      cmd_obj.run()
    File "setup.py", line 449, in run
      raise DeprecationWarning(msg)
  DeprecationWarning: The pymssql project has been discontinued.  To install the last working released version, use a
  version specifier like "pymssql<3.0".  For details and alternatives see:
  https://github.com/pymssql/pymssql/issues/668
  ----------------------------------------
  ERROR: Failed building wheel for pymssql
  Running setup.py clean for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly
[root@centos tmp]    

分析

遇到问题不要怕,也不要慌,沉着冷静,总有解决方法。
仔细看报错信息,突然有一条实际上已经告诉了答案。就是版本不匹配,
,那如何才能版本匹配呢?
需要低于3.0版本的pymssql才能安装。

解决命令

命令如下:

pip install "pymssql<3.0"
pip list

如下图:
在这里插入图片描述

总结

当报错信息是版本不匹配时,按照提示信息,输入正确的版本限制语法,安装就成功了。

好了,聪明如你,就讲到这里吧,有问题的话可以留言。
在这里插入图片描述

  • 9
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 8
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值