简体   繁体   中英

How to install pymssql module in Python 3.6?

I have been through a couple of documentations involving FreeTDS, Wheel, git and github but nothing was working on my Windows 10 PC with Python 3.6 but I need to install it. I'm working on a project and I'm most comfortable with mssql which is already installed in my pc.

this seems to work from

export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1

pip install pymssql

Remember to install FreeTDS first.

Ubuntu/Debian:

sudo apt-get install freetds-dev

Mac OS X with Homebrew:

brew install freetds

Finally:

pip install pymssql

As the site pymssql_documentation page states that the module is deprecated,

we can use pip install "pymssql<3.0" . It works on python 3.0 and above.

I think they should change it in the main copy area as well. as of 12/17/2019 it is still showing pip install pymssql , which has been updated on Nov 16 2019.

Just use the newest build of pymssql from gitub:

pip3 install git+https://github.com/pymssql/pymssql

Also works for python2

pip install git+https://github.com/pymssql/pymssql

UPDATE:

For macOS Big Sur Apple M1 chip processor:

  • You will need to install Rosetta2 emulator for the new ARM silicon (M1 chip). I just installed Rosetta2 via terminal using:
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  • Homebrew for ARM M1 chip:
arch -x86_64 brew install freetds
  • Homebrew for M1 ARM command to install packages: arch -x86_64 brew install <package> . It is necessary to install FreeTDS before installing the pymssql .
pip install pymssql

Finally:

Collecting pymssql
  Using cached pymssql-2.1.5.tar.gz (167 kB)
  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) ... done
  Created wheel for pymssql: filename=pymssql-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl size=287029 
.
.
.
Successfully built pymssql
Installing collected packages: pymssql
Successfully installed pymssql-2.1.5

output:

 Collecting pymssql Using cached pymssql-2.1.5.tar.gz (167 kB) 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) ... done Created wheel for pymssql: filename=pymssql-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl size=287029 . . . Successfully built pymssql Installing collected packages: pymssql Successfully installed pymssql-2.1.5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM