Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2015-07-07 19:15:32
Size: 1758
Editor: LanceEdgar
Comment: Initial version, copied/updated from Installation/Python/Windows.
Revision 3 as of 2019-06-19 01:45:26
Size: 2595
Editor: LanceEdgar
Comment: Update download link for PyWin32
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
There are surely lots of ways to install Python on Windows, and these steps are not necessarily "superior" to other methods. However they do have the benefit of being relatively well-tested in production environments. There are surely lots of ways to install Python on Windows, and these steps are not necessarily "superior" to other methods, if you know what you're doing. But they do have the benefit of being relatively well-tested in production environments.
Line 17: Line 17:
Download the appropriate installer and run it. Make sure that during the wizard step titled "Customize Python 2.7.x" you change the "Add python.exe to Path" setting (bottom of the list) to "Will be installed on local hard drive". (Or alternatively you may add Python to your PATH variable manually after the install completes.) All other defaults are fine. Download the appropriate installer and run it. Make sure that during the wizard step titled "Customize Python 2.7.x" you change the "Add python.exe to Path" setting (bottom of the list) to "Will be installed on local hard drive". All other defaults are fine.

At this point you should be able to open a
(new!) command line and confirm `python.exe` is usable:

{{{
C:\>python --
version
Python 2.7.10
}}}

If that doesn't work, you may need to manually add `C:\Python27;C:\Python27\Scripts` to your [[http://www.computerhope.com/issues/ch000549.htm|
PATH environment variable]].
Line 21: Line 30:
The situation on Windows is a little more complicated, and the short version is that you must also install Mark Hammond's "Python for Windows Extensions" package, available at [[http://sourceforge.net/projects/pywin32/files/]]. The situation on Windows is a little more complicated, and the short version is that you must also install Mark Hammond's "Python for Windows Extensions" package, available at [[https://github.com/mhammond/pywin32/releases]].
Line 24: Line 33:

== Pip ==

If you just downloaded a fresh copy of Python (above), then you should already have a copy of pip. If you are working with an older install of Python etc. it is possible that you may not yet have pip. Open a command line to find out:

{{{
C:\>pip --version
pip 7.0.1 from C:\Python27\lib\site-packages (python 2.7)
}}}

If that doesn't work (but `python --version` does) then you probably need to install pip. The recommended method is via the `get-pip.py` script according to [[https://pip.pypa.io/en/latest/installing.html#install-pip|these instructions]].

Installing Python on Windows

There are surely lots of ways to install Python on Windows, and these steps are not necessarily "superior" to other methods, if you know what you're doing. But they do have the benefit of being relatively well-tested in production environments.

32 bit vs. 64 bit

In certain cases the Python interpreter may need to load and invoke code from various compiled libraries. Sometimes these libraries are only available in a 32 bit version. This issue may or may not come up in your individual situation, but as a rule only 32 bit Python is recommended, even on 64 bit machines.

Python

First of course you'll need Python itself, available at https://www.python.org/downloads/windows/.

The only well-supported version is Python 2.7. Certainly Python 3.x is not (yet) supported. Again, you are encouraged to stick with 32 bit Python even if running a 64 bit machine.

Download the appropriate installer and run it. Make sure that during the wizard step titled "Customize Python 2.7.x" you change the "Add python.exe to Path" setting (bottom of the list) to "Will be installed on local hard drive". All other defaults are fine.

At this point you should be able to open a (new!) command line and confirm python.exe is usable:

C:\>python --version
Python 2.7.10

If that doesn't work, you may need to manually add C:\Python27;C:\Python27\Scripts to your PATH environment variable.

Python for Windows Extensions

The situation on Windows is a little more complicated, and the short version is that you must also install Mark Hammond's "Python for Windows Extensions" package, available at https://github.com/mhammond/pywin32/releases.

The specific version you download should match the version of Python you installed, above. Again the recommendation is Python 2.7, 32 bit. Run the installer; all defaults are fine.

Pip

If you just downloaded a fresh copy of Python (above), then you should already have a copy of pip. If you are working with an older install of Python etc. it is possible that you may not yet have pip. Open a command line to find out:

C:\>pip --version
pip 7.0.1 from C:\Python27\lib\site-packages (python 2.7)

If that doesn't work (but python --version does) then you probably need to install pip. The recommended method is via the get-pip.py script according to these instructions.

Installation/Windows/Python (last edited 2021-10-30 20:12:08 by LanceEdgar)