헤르메스 LIFE

[Python] pymssql 설치 시 오류 - Microsoft Visual C++ 14.0 or greater is required. 본문

Exception

[Python] pymssql 설치 시 오류 - Microsoft Visual C++ 14.0 or greater is required.

헤르메스의날개 2021. 3. 2. 23:52
728x90

MSSQL 과 Connection 을 연결하기위해 pymssql 모듈을 설치 하던 중 아래와 같은 오류가 발생하였습니다.

pymssql은 Python DB API (PEP-249) 스펙을 따르는 FreeTDS 위에 구현된 파이썬 모듈입니다.


(venv) C:\JetBrains\pythonProject\venv\Scripts>pip install pymssql
Collecting pymssql
Downloading pymssql-2.1.5.tar.gz (167 kB)
|████████████████████████████████| 167 kB 1.6 MB/s
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: 'c:\jetbrains\pythonproject\venv\scripts\python.exe' 'c:\jetbrains\pythonproject\venv\lib\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\HERMES~1\AppData\Local\Temp\t
mp8a43_2md'
cwd: C:\Users\user\AppData\Local\Temp\pip-install-xjqcixib\pymssql_8ac880b6279f4874aff13d06735da2e7
Complete output (9 lines):
setup.py: platform.system() => 'Windows'
setup.py: platform.architecture() => ('64bit', 'WindowsPE')
running bdist_wheel
running build
running build_ext
cythoning src\_mssql.pyx to src\_mssql.c
cythoning src\pymssql.pyx to src\pymssql.c
building '_mssql' extension
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for pymssql
Failed to build pymssql
ERROR: Could not build wheels for pymssql which use PEP 517 and cannot be installed directly


C++ 14.0 버전 이상의 컴파일러가 있어야 한다는군요. ㅡㅡㅋ

 

1. 아래 링크에서 pymssql‑2.1.5‑cp39‑cp39‑win_amd64.whl 파일을 다운로드 받습니다.

www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql

 

Python Extension Packages for Windows - Christoph Gohlke

by Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine. Updated on 1 March 2021 at 15:39 UTC. This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython

www.lfd.uci.edu

2. 설치합니다.

(venv) C:\JetBrains\pythonProject\venv\Scripts>pip install pymssql-2.1.5-cp39-cp39-win_amd64.whl
Processing c:\jetbrains\pythonproject\venv\scripts\pymssql-2.1.5-cp39-cp39-win_amd64.whl
Installing collected packages: pymssql
Successfully installed pymssql-2.1.5

 

참조

docs.microsoft.com/ko-kr/sql/connect/python/pymssql/step-1-configure-development-environment-for-pymssql-python-development?view=sql-server-ver15

 

1단계: pymssql 환경 구성 - SQL Server

이 시작 가이드의 1단계에는 Python, Microsoft ODBC Driver for SQL Server 및 pymssql를 개발 환경에 설치하는 작업이 포함됩니다.

docs.microsoft.com

 

728x90