Hi, there, Serdar Yegulalp here for Infoworld at IDG. Today in Smart Python I'm going to look
at the differences between the 32 and 64-bit editions of python and how that can affect
your use of third-party applications note that for this discussion i'm focusing mainly on the
windows version of Python since the difference between 32 and 64-bit is most prominent there
now when you head to the official Python site you'll notice that a slew of different editions
of python are available for download one big difference is that some of them are listed as x86
while others are listed as x86-64 the x86 builds are 32-bit versions and the x86 64
editions are 64-bit editions now most computers today especially most windows machines are 64-bit
and they come with a 64-bit edition windows those versions of windows can run either the 32-bit or
64-bit versions of python so at first it doesn't look like there's much difference between the two
you might also be inclined to think running the 64-bit edition is overkill one of the
main advantages of the 64-bit edition of any application is that it provides access to more
than four gigabytes of contiguous memory since not everybody is crunching gargantuan areas of numbers
sometimes the 32-bit version seems like all you need now all this is true but only up to a point
see the biggest issue with 32-bit editions of python centers around compatibility with
third-party modules Python has a huge universe of software that you can add to it by way of the
pip install command and many of these modules are pure python and will install anywhere but some of
them require binary components to be built for specific platforms these binaries are packaged
in a format called a wheel sometimes you can find a pre-compiled wheel for a package you're looking
for but many software maintainers are not making pre-compiled 32-bit wheels anymore demand for them
has faded now that most everyone is using a 64-bit os and a 64-bit edition of Python to go with it
so to that end the 32-bit editions of python are going to be harder to work with when it comes to
third-party modules they won't always have pre-compiled wheels for third-party modules
and this can cause unexpected interruptions in your workflow now if for some reason you're
stuck with the 32-bit edition for instance if you have some other 32-bit pre-compiled binary
that you can't upgrade there are workarounds first some kind folks have created their own
32-bit wheels for many packages that don't have them provided by default Christopher
Golke whose site i'm showing here and linking in the video description is one such provider
as you can see he provides builds for a lot of projects so let's say i wanted to install the aio
http module in python 3.9 32-bit for which there is no pre-built binary i have here in this folder
a pre-compiled 32-bit wheel from Christopher Gokey's site i can install it into my 32 edition
of python 3.9 just by passing it to pip now what would happen if we did not have a 32-bit wheel
anywhere in that case pip would attempt to find build tools to create the binary on my computer
in windows that's the Microsoft visual c plus plus compiler and it just so happens that i have
the visual c plus tools already installed on this machine since i use them for working with cython
so if i run pip install aio http and i don't use this pre-compiled wheel that i was using before
you're going to see an extra step here where the installer runs the build tools silently in
the background and creates a binary now if you don't have a compiler installed on your machine
this step won't work and if you're in the doubly unfortunate position of not being able to install
the compiler on that machine you're completely out of luck you'd either have to get a binary
from somebody else or you'd have to get to another machine where you could run the compiler so to
sum up the 64-bit edition of python ought to be your default choice at this point given how many
people are providing pre-compiled binaries for it the only time you really need to use the 32-bit
edition is if you're stuck with a 32-bit operating system or if you have to force compatibility with
a 32-bit component but both of those are vanishing exceptions to this rule that's it for this video
if you liked it please leave a comment below don't forget to subscribe to the IDG Tech Talk
channel and for more Smart Python be sure to follow us on facebook youtube and infoworld.com