How to use binary python installers for a mismatching python version? - windows

I need to run a 64bit binary python installer for windows (reportlab‑2.7.win‑amd64‑py2.6.exe) downloaded from http://www.lfd.uci.edu/~gohlke/pythonlibs/.
Unfortunately, I have 64bit python 2.7 installed and can't switch to python 2.6. For compatibility reasons, I also can't switch to the reportlabs package for python 2.7. I am sure that the python 2.6 package is compatible with python 2.7.
The .exe installer won't install since it does not find python 2.6 in the registry. Is there anything I can do?

According to this post and this post, I created the following registry file code to set the required registry keys.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Python]
[HKEY_CURRENT_USER\Software\Python\Pythoncore]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\InstallPath]
#="C:\\Python27"
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\PythonPath]
#="C:\\Python27;C:\\Python27\\Lib\\;C:\\Python27\\DLLs\\"
Save this as a .reg file (e.g. "file.reg") and run it.
Basically, this file stores in the registry that python 2.6 is installed in the python 2.7 folders. You may have to adapt the paths.
After the registry keys were set, I was able to install the 64bit reportlabs package using the binary installer for python 2.6 with a python 2.7 installation. I didn't encounter any compatibility issues.
If you want to use this way for 32bit python, see the above mentioned posts.

Related

Python 3.5 64bit on Windows 8.1 64bit, The only way to install TensorFlow binaries on Windows does not work

Is it possible to install Python 3.5.x on Windows 8.1?
The primary goal is to install TensorFlow directly on my Windows.
It is not working. More specifically when using a 64 bit windows, and naturally trying the 64bits Python. The AMD name in the installation file is confusing, since my laptop is an Intel. But that is the only 64 bit option so I select that.
I try to set up via binaries. In the middle of installation a GUI tells me installation failed:
BTW, I have done my best to remove any remaining Python 32 bits from my system.
Gooogling "python supported windows versions" brings up Using Python on Windows — Python 3.5.3 documentation1:
3.1.1. Supported Versions
As specified in PEP 11, a Python release only supports a Windows
platform while Microsoft considers the platform under extended
support. This means that Python 3.5 supports Windows Vista and newer.
If you require Windows XP support then please install Python 3.4.
1Or rather, https://docs.python.org/3/using/windows.html from which you can switch to the 3.5's version of the article with the drop-down list in the upper-left corner
After running windows update, I finally managed to install python 3.5 64 bits and then tensorflow on my windows 8.1.

What is needed for curses in Python 3.4 on Windows7?

I have a running Python 2.7/3.4 installation on my Windows 7 (x64) machine. I would like to test curses on Windows.
Curses is installed but not working:
>>> import curses
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Tools\Python3.4.2\lib\curses\__init__.py", line 13, in <module>
from _curses import *
ImportError: No module named '_curses'
The documentation says:
The Windows version of Python doesn’t include the curses module. A ported version called UniCurses is available.
So, the Windows installer of Python 3.4 installed curses with unresolved dependencies. One could name this a bug...
OK, I looked into UniCurses. It's a wrapper for PDCurses:
UniCurses is a wrapper for Python 2.x/3.x that provides a unified set of Curses functions on all platforms (MS Windows, Linux, and Mac OS X) with syntax close to that of the original NCurses. To provide the Curses functionality on Microsoft Windows systems it wraps PDCurses.
Installing UniCurses via pip3 results in an error:
C:\Users\Paebbels>pip3 install UniCurses
Downloading/unpacking UniCurses
Could not find any downloads that satisfy the requirement UniCurses
Some externally hosted files were ignored (use --allow-external UniCurses to allow).
Cleaning up...
No distributions at all found for UniCurses
Storing debug log for failure in C:\Users\Paebbels\pip\pip.log
The link to SourceForge on Python's UniCurses site is dead. A manual search an SourceForge helped to find UniCurses for Python again.
But, the UniCurses 1.2 installer can not find any Python installation in my Windows registry. (Python 2.7.9 and Python 3.4.2 are available).
I also looked into Public Domain Curses (PDCurses). PD Cureses 3.4 is from late 2008. So it's 7 years old. I don't believe it will work either with Windows 7 nor Windows 8.1 or Windows 10.
Is there any way to get curses running on Windows with Python.
(The Windows Python, not the CygWin Python!)
You can use curses cross-platform (Windows, MacOS, GNU/Linux) if you install manually for Windows or like other package in others.
Install wheel package. If you need more info about wheel click here.
Go to this repository.
Download a package with your python version, in example for python 3.4:
curses-2.2-cp34-none-win_amd64.whl
Install it (this command if for windows, in GNU/Linux install like other package)
python -m pip install curses-2.2-cp34-none-win32.whl
Just include in your python script:
import curses
You can use curses wrapper for python. Works in Fedora 25 in all terminals, and Windows 10 using git bash, powershell, or cmd.
Update:
An alternative to curses in Windows here.
Console user interface in Windows here.
An interesting tutorial here.
Now we can easy install on python 3.7 using pip install windows-curses
You can try my mirror of unicurses, which includes pdcurses dlls. I have it currently up and running on windows 7 with python 3.5.0.
To quickly test if it works for you, just clone the repository and create and run a python script within its toplevel directory containing something like
from unicurses import *
stdscr = initscr()
addstr("hello world")
getch()

ZODB 3 for 64 bit windows

I tried to install ZODB3 for 64 bit Python 2.7 with pip. This installation requires a local compiler to compile the BTrees extension. As I do not have the needed MS compiler installed:
Is there a binary 64 bit Windows installer for ZODB on Python 2.7 ? I used Google but did not succeed
Is BTrees really required or can I install ZODB3 without BTrees ?
Cherrs, Uwe.
The ZODB3 package comes with pre-compiled eggs for Windows, see the PyPI page for ZODB3.
You need to tell pip explicitly that it needs to install an egg; it normally does not support installing from an egg:
pip install --egg ZODB3
Alternatively, you could use easy_install instead.
Struggling with ZODB3 easy_install/pip/compiler woes on Windows? Try Christoph Gohlke's "Unofficial Windows Binaries for Python Extension Packages" download page:
64 and 32 bit ZODB3 binaries packaged as .exe installers are available for python 2.5/2.6/2.7: http://www.lfd.uci.edu/~gohlke/pythonlibs/#zodb3
You will need to run the appropriate zope.interface installer from the same source first: http://www.lfd.uci.edu/~gohlke/pythonlibs/#Zope.interface

Python 3.x in Cygwin?

I have the python package in Cygwin on Windows 7. However, typing
python -V
returns
Python 2.6.8
This is a pretty low version of Python... I could use Python 3.x (whatever version is newest, preferably). I've seen some people say you have to download a .zip or .tar manually to get it (similar to this question). My questions are as follows (please note this is NOT a duplicate of the linked question):
Can I get Python 3.x somehow using the Cygwin package manager?
Can/should I get rid of Python 2.6 if I manage to get Python 3.x running? None of my code runs on anything specific to Python 2.6.
Thanks
As others have noted, the version of Python 2.6 that's installed with Cygwin is recent; Python release numbers are not linear with respect to time. The Python releases page details which versions were released on which date.
You can install Python3 if you want, using Cygwin Ports. This is a collection of Cygwin packages that are not ready for general release on the main Cygwin mirrors, but have been compiled ready to be used on Cygwin. I've written some instructions over on SuperUser which describe in more detail how to do this.
(I'd avoid installing from source, as Lennart suggests, as I'd expect this will require non-trivial fixes to make it work on Cygwin.)
As noted in the above-linked SuperUser question, there's no need to uninstall Python 2.6 to install Python 3; the two run happily side-by-side.
That said, beware your claim that "None of my code runs on anything specific to Python 2.6": Python 3.x is not back compatible with Python 2.x, and code written for Python 2.x will generally not work on Python 3.x without work to adapt it. The Python 3.0.1 What's New Guide has a good overview of the changes in Python 3.x.
Update: As of Wed 25 July 2012, Python 3.2.3 is included in the standard Cygwin installer. Just run Cygwin's setup.exe again (download it from cygwin.com again if you need to), and you should be able to select and install it like any other package.

Installing OpenCV on Windows 7 for Python 3.2.3 [duplicate]

am trying desperately to get OpenCV to work on Windows 7. I download and installed it, and it didn't work, I got
ImportError: No module named opencv
when I tried to run one of the samples. I google my problem and got only random solutions that don't work. Can anybody guide me in installing it, or know where i can get a clear installation guide design for a programming noob.
As of OpenCV 2.2.0, the package name for the Python bindings is "cv".The old bindings named "opencv" are not maintained any longer. You might have to adjust your code. See http://opencv.willowgarage.com/wiki/PythonInterface.
The official OpenCV installer does not install the Python bindings into your Python directory. There should be a Python2.7 directory inside your OpenCV 2.2.0 installation directory. Copy the whole Lib folder from OpenCV\Python2.7\ to C:\Python27\ and make sure your OpenCV\bin directory is in the Windows DLL search path.
Alternatively use the opencv-python installers at http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv.
I have posted a very simple method to install OpenCV 2.4 for Python in Windows here : Install OpenCV in Windows for Python
It is just as simple as copy and paste. Hope it will be useful for future viewers.
Download Python, Numpy, OpenCV from their official sites.
Extract OpenCV (will be extracted to a folder opencv)
Copy ..\opencv\build\python\x86\2.7\cv2.pyd
Paste it in C:\Python27\Lib\site-packages
Open Python IDLE or terminal, and type
>>> import cv2
If no errors shown, it is OK.
UPDATE (Thanks to dana for this info):
If you are using the VideoCapture feature, you must copy opencv_ffmpeg.dll into your path as well. See: https://stackoverflow.com/a/11703998/1134940
I have posted an entry to setup OpenCV for Python in Windows:
http://luugiathuy.com/2011/02/setup-opencv-for-python/
Hope it helps.
Actually you can use x64 and Python 2.7. This is just not delivered in the standard OpenCV installer. If you build the libraries from the source (http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html) or you use the opencv-python from cgohlke's comment, it works just fine.
download the opencv 2.2 version from https://sourceforge.net/projects/opencvlibrary/files/opencv-win/
install package.
then Copy cv2.pyd to C:/Python27/lib/site-packeges.
and it should work:
import cv2
open command prompt and run the following commands (assuming python 2.7):
cd c:\Python27\scripts\
pip install opencv-python
the above works for me for python 2.7 on windows 10 64 bit
One thing that needs to be mentioned. You have to use the x86 version of Python 2.7. OpenCV doesn't support Python x64. I banged my head on this for a bit until I figured that out.
That said, follow the steps in Abid Rahman K's answer. And as Antimony said, you'll need to do a 'from cv2 import cv'
Installing OpenCV on Windows 7 for Python 2.7

Resources