I am trying to write a small gtk application with Python.
I was told that you should use msys2 for MS-Windows. See related question: Setting up developement environment: PyCharm, python-gtk, windows
Now I need cx_freeze. There are wheel-files for windows, but I guess the msys2 environment is different, and that's why installing "cx_freeze" fails (no gcc around).
See files of cx_freeze: https://pypi.org/project/cx_Freeze/#files
Now I am unsure if I am on the right track.
Is there a way to use the ready build wheels from a python which is started in msys2 (In my case C:\msys32\usr\bin\python3.exe)
Installing cx_freeze worked after installing gcc. But now I get this error:
cx_Freeze.freezer.ConfigError: no base named Console
I guess I should not compile cx_freeze and get my environment use the provided wheels.
Update
I leave this question open, because someone else could find a solution and help someone else again. But I switched from gtk to pyside2 (QT). Everything is much easier now.
I was trying to install PyQt 5.9 but I have no idea what I'm doing. According to what I've seen I have to download Qt from:
https://qt-project.org
and then SIP (whatever that is...) and PyQt from:
http://www.riverbankcomputing.com
I did all that and Qt weights like 30 Gb...
Now I have to install pyqt but the README.md file says this:
'''INSTALLATION
Check for any other README files in this directory that relate to your
particular platform. Feel free to contribute a README for your platform or to
provide updates to any existing documentation.
The first step is to configure PyQt5 by running the following command.
python configure.py
'''
And I have no idea what to do now, I keep getting the 'no such file/directory found' error.
I went to the directory where I have python installed and I still get the same.
-
I have a Mac and python 3.6
Turns out I have Qt 5.8 already installed, and since I just downloaded 5.9 I'd like to upgrade it but I don't know how. And maybe it's taking up another 30Gb somewhere else.
Also, when I type 'which python' I get 'anaconda/bin/python' and not python 2.7, how do I fix that? also I went to the dir where I have python and have python 2.4, 2.5 and 2.7. Should I just delete the others? and what is SIP??
Check these steps
Go to the QT website and download it.
Install python on your pc,
If it's Linux: sudo apt-get install python3.6
Or see this link.
Install also some IDLE to work on, I'd recommend you to use PyCharm
You can install now your PyQt through your Pycharm, see in here, find for pyqt5.
There is always the option to install through pip3, try to use pip3 instead of pip, since you are using python3.
After having pip3, try now to install your pyqt5. Check it out.
Now you have an IDLE to work on with PyQt and Qt in your machine, maybe you have to say in your PyCharm that you will use python3.6 as your interpreter.
so, i want to learn python and looking around for python IDE, i already have PyCharm but i also want to be able to make GUI so i download eric IDE
eric IDE need these prerequisites to install
Python 3.1.0 or better
Python 2.6.0 or better
Qt 5.3.0 or better (from Digia)
Qt 4.10.0 or better (from Digia)
PyQt 5.3.0 or better (from Riverbank)
PyQt 4.10.0 or better (from Riverbank)
QScintilla 2.8.0 or better (from Riverbank)
i already download them all and able to install python 2.7 but i don't understand how to install the other, the only guide i found is only for win xp or linux.
I just went through this process on Windows 7, so hopefully I can help you.
If you are running Windows7, get the following:
1) Python 2.7.0 link (11 was the version I used) amd64 - I got bit by this. When you follow the download link on the eric website, click on the version number instead of the download link. This will give you the option of downloading the x64 version.
2) PyQT 4.10 link -You will want to get this version if you are using python 2.7.x. There are no 5.x builds for Python 2.7. When looking to download the binaries (unless you want to compile), pay close attention to both the x64/x32 and the Py[ver] the link is for.
Note, it is important that both Python and PyQt be in sync for x32/x64 or Eric will not compile. It is also important to note that PyQt is Python version sensitive. PyQt 5.3.x is currently only built for Python 3.3.x, not Py 2.3x. PyQt 4.10.x has been built for both Py 2.7.x and Py 3.3.x
3) The Eric Zip, uncompressed, in a writable directory for the user.
Install Python first, followed by PyQt (It installs in the Python Directory), and then run the install.py from the root directory of eric. Watch the cmd window carefully since it will give you some useful information if things don't work.
If you're on Windows, you can get binary packages from the PyQt4 download page that will install everything except Python and Eric.
Ignore the source packages at the top of the page - scroll down to where the Windows exe installers are and make sure you pick the right one for the version of Python you want to use (2.7 or 3.4) and the platform you're on (32bit or 64bit).
You don't need any of those other downloads. Since you already seem to have Python installed, all you need to do is run the PyQt4 installer, and then run the Eric installer.
There is also a PyQt Wiki which you might find helpful if you're just getting started.
Python 3.4.4 may be a better choice than 2.7 in the long run.
For other stuff. this page may be helpful:
http://techattitude.com/tips-tricks-and-hacks/how-to-install-eric6-ide-for-python-on-windows/
It is not that easy to install eric6 on Windows 8.1 x64.
Python 3.5.1 x64 installs in \appdata\local\programs\python\python35.
Pyqt5.5.1 x64 does not detect python 3.5 and it is only built for python 3.4, and starts to drop a folder called C:\python34.
Further googling provided no help, only this stackoverflow question.
I read here that
On Windows, your Python version must match the version used to compile Mercurial. Otherwise, you'll get "Invalid Magic Number" errors when trying to run the CGI. The pre-compiled Windows binaries for Mercurial 1.0.x, 1.1.x, 1.2.x and 1.3.x were compiled with Python 2.5.
I looked online but I dont see a lookup table for this information.
Where can I find it?
If you're on Windows you want to install TortoiseHG. It provides the full Mercurial command line, a GUI with Windows shell integration, and the right version of Python all compiled in together.
The various HG installation packages have the required Python version in their name. You can also look it up in the release notes for the package.
I am finding it difficult to use MySQL with Python in my windows system.
I am currently using Python 2.6. I have tried to compile MySQL-python-1.2.3b1 (which is supposed to work for Python 2.6 ?) source code using the provided setup scripts. The setup script runs and it doesn't report any error but it doesn't generate _mysql module.
I have also tried setting up MySQL for Python 2.5 with out success. The problem with using 2.5 is that Python 2.5 is compiled with visual studio 2003 (I installed it using the provided binaries). I have visual studio 2005 on my windows system. Hence setuptools fails to generate _mysql module.
Any help ?
Download page for python-mysqldb. The page includes binaries for 32 and 64 bit versions of for Python 2.5, 2.6 and 2.7.
There's also discussion on getting rid of the deprecation warning.
UPDATE: This is an old answer. Currently, I would recommend using PyMySQL. It's pure python, so it supports all OSes equally, it's almost a drop-in replacement for mysqldb, and it also works with python 3. The best way to install it is using pip. You can install it from here (more instructions here), and then run:
pip install pymysql
This may read like your grandpa givin advice, but all answers here did not mention the best way: go nd install ActivePython instead of python.org windows binaries. I was really wondering for a long time why Python development on windows was such a pita - until I installed activestate python. I am not affiliated with them. It is just the plain truth. Write it on every wall: Python development on Windows = ActiveState!
you then just pypm install mysql-python and everything works smoothly. no compile orgy. no strange errors. no terror. Just start coding and doing real work after five minutes.
This is the only way to go on windows. Really.
As Python newbie learning the Python ecosystem I've just completed this.
Install setuptools instructions
Install MySQL 5.1. Download the 97.6MB MSI from here You can't use the essentials version because it doesnt contain the C libraries.
Be sure to select a custom install, and mark the development tools / libraries for installation as that is not done by default. This is needed to get the C header files.
You can verify you have done this correctly by looking in your install directory for a folder named "include". E.G C:\Program Files\MySQL\MySQL Server 5.1\include. It should have a whole bunch of .h files.
Install Microsoft Visual Studio C++ Express 2008 from here This is needed to get a C compiler.
Open up a command line as administrator (right click on the Cmd shortcut and then "run as administrator". Be sure to open a fresh window after you have installed those things or your path won't be updated and the install will still fail.
From the command prompt:
easy_install -b C:\temp\sometempdir mysql-python
That will fail - which is OK.
Now open site.cfg in your temp directory C:\temp\sometempdir and edit the "registry_key" setting to:
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.1
now CD into your temp dir and:
python setup.py clean
python setup.py install
You should be ready to rock!
Here is a super simple script to start off learning the Python DB API for you - if you need it.
I found a location were one person had successfully built mysql for python2.6, sharing the link, http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe
...you might see a warning while import MySQLdb which is fine and that won’t hurt anything,
C:\Python26\lib\site-packages\MySQLdb__init__.py:34: DeprecationWarning: the sets module is deprecated
from sets import ImmutableSet
What about pymysql? It's pure Python, and I've used it on Windows with considerable success, bypassing the difficulties of compiling and installing mysql-python.
You're not the only person having problems with Python 2.6 and MySQL (http://blog.contriving.net/2009/03/04/using-python-26-mysql-on-windows-is-nearly-impossible/). Here's an explanation how it should run under Python 2.5 http://i.justrealized.com/2008/04/08/how-to-install-python-and-django-in-windows-vista/
Good luck
The precompiled binaries on http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python is just worked for me.
Open MySQL_python-1.2.5-cp27-none-win_amd64.whl file with zip
extractor program.
Copy the contents to
C:\Python27\Lib\site-packages\
On Python 3.4 I've installed mysqlclient from http://www.lfd.uci.edu/~gohlke/pythonlibs/ with pip install mysqlclient and it's working.
You can try to use myPySQL. It's really easy to use; no compilation for windows, and even if you need to compile it for any reason, you only need Python and Visual C installed (not mysql).
http://code.google.com/p/mypysql/
Good luck
There are Windows binaries for MySQL-Python (2.4 & 2.5) available on Sourceforge. Have you tried those?
Because I am running python in a (pylons/pyramid) virtualenv, I could not run the binary installers (helpfully) linked to previously.
I had problems following the steps with Willie's answer, but I determined that the problem is (probably) that I am running windows 7 x64 install, which puts the registry key for mysql in a slightly different location, specifically in my case (note: I am running version 5.5) in: "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MySQL AB\MySQL Server 5.5".
HOWEVER, "HKEY_LOCAL_MACHINE\" cannot be included in the path or it will fail.
Also, I had to do a restart between steps 3 and 4.
After working through all of this, IMO it would have been smarter to run the entire python dev environment from cygwin.
If you are looking for Python 3.2 this seems the best solution I found so far
for Python 2.4 - 3.2 PyMySQL
for Python 2.3 - 2.6 MySQL for Python
Source: http://wiki.python.org/moin/MySQL
You might want to also consider making use of Cygwin, it has mysql python libraries in the repository.
You can also use pyodbc with the MySQL Connector/ODBC to use MySQL on Windows. Unixodbc is also available to make the code compatible on Linux. Pyodbc uses the standard Python DB API 2.0 so if you stick with that switching between MySQL/PostgreSQL/SQLite/ODBC/JDBC drivers etc. should be relatively painless.
upvoted itsadok's answer because it led me to the installation for python 2.7 as well, which is located here: http://www.codegood.com/archives/129
Got sick of the installation troubles with MySQLdb and tried pymysql instead.
Easy setup;
git clone https://github.com/petehunt/PyMySQL.git
python setup.py install
And APIs are pretty much the same.