Difference between revisions of "Python with WIndows and Cygwin"
PeterHarding (talk | contribs) |
PeterHarding (talk | contribs) |
||
Line 36: | Line 36: | ||
@echo Installation successfull & pause | @echo Installation successfull & pause | ||
</pre> | </pre> | ||
=OR= | |||
From - http://stackoverflow.com/questions/34704706/connect-to-sql-server-using-sqlalchemy | |||
I wrote a tutorial [http://thelaziestprogrammer.com/sharrington/databases/connecting-to-sql-server-with-sqlalchemy here] of how to do this. | |||
Essentially, you need to: | |||
<pre> | |||
brew install unixodbc | |||
brew install freetds --with-unixodbc | |||
Add the freetds driver to odbcinst.ini | |||
Add a DSN (Domain Source Name) to odbc.ini named "MY_DSN" | |||
pip install pyodbc | |||
e = create_engine("mssql+pyodbc://username:password@MY_DSN") | |||
</pre> | |||
The walkthrough here does a much more thorough job of explaining this, including issues with SQL Server/FreeTDS Protocol Version Compatibility. | |||
[[Category:Python]] | [[Category:Python]] | ||
[[Category:Cygwin]] | [[Category:Cygwin]] | ||
[[Category:Windows]] | [[Category:Windows]] |
Latest revision as of 17:42, 28 April 2017
See - http://stackoverflow.com/questions/27885397/how-do-i-install-a-python-package-with-a-whl-file
To be able to install wheel files with a simple doubleclick on them you can do one the following:
1) Run two commands in command line under administrator privileges:
assoc .whl=pythonwheel ftype pythonwheel=cmd /c pip.exe install "%1" ^& pause
2) Alternatively, they can be copied into a wheel.bat file and executed with 'Run as administrator' checkbox in the properties.
PS pip.exe is assumed to be in the PATH.
Update:
(1) Those can be combined in one line:
assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%1" ^& pause
(2) Syntax for .bat files is slightly different:
assoc .whl=pythonwheel& ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause
Also its output can be made more verbose:
@assoc .whl=pythonwheel|| echo Run me with administrator rights! && pause && exit 1 @ftype pythonwheel=cmd /c pip.exe install -U "%%1" ^& pause || echo Installation error && pause && exit 1 @echo Installation successfull & pause
OR
From - http://stackoverflow.com/questions/34704706/connect-to-sql-server-using-sqlalchemy
I wrote a tutorial here of how to do this.
Essentially, you need to:
brew install unixodbc brew install freetds --with-unixodbc Add the freetds driver to odbcinst.ini Add a DSN (Domain Source Name) to odbc.ini named "MY_DSN" pip install pyodbc e = create_engine("mssql+pyodbc://username:password@MY_DSN")
The walkthrough here does a much more thorough job of explaining this, including issues with SQL Server/FreeTDS Protocol Version Compatibility.