pip安装pymssql模块时报错“PEP 517”怎么解决?
报错信息
如下图:
[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
遇到问题不要怕,也不要慌,沉着冷静,总有解决方法。
仔细看报错信息,突然有一条实际上已经告诉了答案。就是版本不匹配,
,那如何才能版本匹配呢?
需要低于3.0版本的pymssql才能安装。
解决命令
命令如下:
pip install "pymssql<3.0"
pip list
总结
当报错信息是版本不匹配时,按照提示信息,输入正确的版本限制语法,安装就成功了。