欲在ubuntu上安装pymssql,使用pip install pymssql操作,报错如下
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pymssql
Using cached https://pypi.tuna.tsinghua.edu.cn/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: Complete output from command /home/ps/.conda/envs/tensorflow-gpu/bin/python /home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp0ch3x7b2:
ERROR: running bdist_wheel
running build
installing to build/bdist.linux-x86_64/wheel
running install
/tmp/pip-build-env-_hpbcwoh/overlay/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 "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 207, in <module>
main()
File "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/site-packages/pip/_vendor/pep517/_in_process.py", line 141, in build_wheel
metadata_directory)
File "/tmp/pip-build-env-_hpbcwoh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 209, in build_wheel
wheel_directory, config_settings)
File "/tmp/pip-build-env-_hpbcwoh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 194, in _build_with_temp_dir
self.run_setup()
File "/tmp/pip-build-env-_hpbcwoh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 237, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-_hpbcwoh/overlay/lib/python3.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 493, in <module>
tests_require=['pytest', 'unittest2'],
File "/tmp/pip-build-env-_hpbcwoh/overlay/lib/python3.7/site-packages/setuptools/__init__.py", line 145, in setup
return distutils.core.setup(**attrs)
File "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/tmp/pip-build-env-_hpbcwoh/overlay/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 228, in run
self.run_command('install')
File "/home/ps/.conda/envs/tensorflow-gpu/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/ps/.conda/envs/tensorflow-gpu/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
观察报错信息,在第五十一行给了一个解决办法,安装版本"pymssql<3.0",所以开始报错的原因就是版本的不匹配,解决方案如下:pip install “pymssql<3.0”