WindowsPython: Difference between revisions

From UMIACS
Jump to navigation Jump to search
Aberli (talk | contribs)
No edit summary
Ianc (talk | contribs)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Python can be user installed.
Below are installation instructions for both .exe and MSI installers. MSI installers have been discontinued for Python version 3.5 and above.
== Installing Python via .exe ==
# Download Python application of the version you want from [https://www.python.org/download/ here]. Note that there are options for the 32-bit or 64-bit version, but you might need to do some searching.
# Click run, to run the installer.
#* [[File:click_run.png|850px|alt="Refer to adjacent text"]]
# Select Install Now. Make sure that you uncheck the "Install launcher for all users" box. Leaving this checked will cause the installation to fail.
#* [[File: select_location.png|600px|alt="Screenshot of Python setup"]]
# Finish the installation [https://www.python.org/download/ here].


== Installing Python ==
This installer will automatically allow you to access Python from the command line by just typing <code>py</code> instead of the full path.
Python can be user installed.


# Download Python windows MSI installer of the version you want from [https://www.python.org/download/ here]
== Installing Python via MSI ==
# Click run, to run the installer  
# Download Python windows MSI installer from [https://www.python.org/download/ here]. Note that there are options for the 32-bit or 64-bit version, but you might need to do some searching.
#* [[File:click_run.png|850px ]]
# Click run, to run the installer.
# Select a home directory as the install folder (i.e.<code>C:\Users\[YOURUSERNAME]\Documents\Pythonx.x.x</code>)  where x represents the version number
#* [[File:click_run_msi.PNG|750px|alt="Refer to adjacent text"]]
#* [[File: select_location.png|700px]]
# Select a home directory as the install folder (i.e.<code>C:\Users\[YOURUSERNAME]\Documents\Pythonx.x.x</code>)  where x represents the version number.
# Finish the installation
#* [[File: select_location_msi.PNG|500px|alt="Screenshot of Python Installer directory selection"]]
# Finish the installation.


If you want to be able to access Python from the command line by just typing <code>python</code> instead of the full path (i.e. <code>\temp\pythonfolder\python</code>) you have to add the python folder to your path.
If you want to be able to access Python from the command line by just typing <code>python</code> instead of the full path (i.e. <code>\temp\pythonfolder\python</code>) you have to add the python folder to your path.
Line 17: Line 26:
#* If it exists, add the python directory to the end of the Path value separated by a semicolon (i.e. <code>C:\Things\In\Path;C:\Path\To\Python\Folder</code>)
#* If it exists, add the python directory to the end of the Path value separated by a semicolon (i.e. <code>C:\Things\In\Path;C:\Path\To\Python\Folder</code>)
#* If it does not, press the New button and set the variable name to <code>Path</code> and the value to the path to your python directory
#* If it does not, press the New button and set the variable name to <code>Path</code> and the value to the path to your python directory


== Installing Modules ==
== Installing Modules ==
Line 33: Line 41:
;These steps assume that Visual Studio is installed (It is by default)
;These steps assume that Visual Studio is installed (It is by default)
First, we configure python to work with Visual Studio
First, we configure python to work with Visual Studio
# Open the file <code>msvc9compiler.py</code>  from  the location <code>C:\Path|To\Python\Folder\...\Lib\distutils\msvc9compiler.py </code> using a text editor such as notepad
# Open the file <code>msvc9compiler.py</code>  from  the location <code>C:\Path\To\Python\Folder\...\Lib\distutils\msvc9compiler.py </code> using a text editor such as notepad
# Replace the line containing <code>toolskey = "VS%0.f0COMNTOOLS" % version </code> with the following <code>toolskey = "vs110COMNTOOLS" </code>, where 110 is a three digit number corresponding to the version number of Visual Studio 2012
# Replace the line containing <code>toolskey = "VS%0.f0COMNTOOLS" % version </code> with the following <code>toolskey = "vs110COMNTOOLS" </code>, where 110 is a three digit number corresponding to the version number of Visual Studio 2012
#:*To do this, type <code> Ctr + a </code> to highlight all the text, and type <code> Ctrl + f </code> to search for the line to be replaced, and edit the file to replace it
#:*To do this, type <code> Ctr + a </code> to highlight all the text, and type <code> Ctrl + f </code> to search for the line to be replaced, and edit the file to replace it
Line 53: Line 61:
# There are several different python modules, so note the name of the module you want to install. numPy will be installed here.
# There are several different python modules, so note the name of the module you want to install. numPy will be installed here.
# Open a command prompt, by pressing the start button, and searching <code> cmd  </code>  
# Open a command prompt, by pressing the start button, and searching <code> cmd  </code>  
#*[[File: Cmd.png | 400px]]  
#*[[File: Cmd.png | 400px|alt="Refer to adjacent text"]]  
# At the prompt, type the full path to easy_install executable and the name of the python module you need. ie. <code> C:\Path\To\Python\Folder\..\Scripts\easy_install.exe module_Name</code>
# At the prompt, type the full path to easy_install executable and the name of the python module you need. ie. <code> C:\Path\To\Python\Folder\..\Scripts\easy_install.exe module_Name</code>
#:where module_Name is the name of the module, numPy in this case  
#:where module_Name is the name of the module, numPy in this case  
#*[[File: Command_line.png | 400px]]
#*[[File: Command_line.png | 400px|alt="Refer to adjacent text"]]
#* '''Click to enlarge'''
#* '''Click to enlarge'''
#Finally, press enter to run and install the module
#Finally, press enter to run and install the module

Latest revision as of 19:07, 3 April 2026

Python can be user installed. Below are installation instructions for both .exe and MSI installers. MSI installers have been discontinued for Python version 3.5 and above.

Installing Python via .exe

  1. Download Python application of the version you want from here. Note that there are options for the 32-bit or 64-bit version, but you might need to do some searching.
  2. Click run, to run the installer.
    • "Refer to adjacent text"
  3. Select Install Now. Make sure that you uncheck the "Install launcher for all users" box. Leaving this checked will cause the installation to fail.
    • "Screenshot of Python setup"
  4. Finish the installation here.

This installer will automatically allow you to access Python from the command line by just typing py instead of the full path.

Installing Python via MSI

  1. Download Python windows MSI installer from here. Note that there are options for the 32-bit or 64-bit version, but you might need to do some searching.
  2. Click run, to run the installer.
    • "Refer to adjacent text"
  3. Select a home directory as the install folder (i.e.C:\Users\[YOURUSERNAME]\Documents\Pythonx.x.x) where x represents the version number.
    • "Screenshot of Python Installer directory selection"
  4. Finish the installation.

If you want to be able to access Python from the command line by just typing python instead of the full path (i.e. \temp\pythonfolder\python) you have to add the python folder to your path.

  1. Navigate to Control Panel -> System and Security -> System
  2. Select Advanced system settings from the sidebar
  3. In the Advanced tab click the Environment Variables... button
  4. Check if a Variable called Path exists in the list of user variables
    • If it exists, add the python directory to the end of the Path value separated by a semicolon (i.e. C:\Things\In\Path;C:\Path\To\Python\Folder)
    • If it does not, press the New button and set the variable name to Path and the value to the path to your python directory

Installing Modules

Using an executable

Alternatively, python executable modules can be found on the web, and the executable installed

Using python

Modules can be installed as the normally would using python.

For instance if the python directory is in your path you merely navigate to the module directory and run:

python setup.py install

Using easy_install

These steps assume that Visual Studio is installed (It is by default)

First, we configure python to work with Visual Studio

  1. Open the file msvc9compiler.py from the location C:\Path\To\Python\Folder\...\Lib\distutils\msvc9compiler.py using a text editor such as notepad
  2. Replace the line containing toolskey = "VS%0.f0COMNTOOLS" % version with the following toolskey = "vs110COMNTOOLS" , where 110 is a three digit number corresponding to the version number of Visual Studio 2012
    • To do this, type Ctr + a to highlight all the text, and type Ctrl + f to search for the line to be replaced, and edit the file to replace it
  3. Also replace the line containing mfinfo = self.manifest_get_embed_info(target_desc, Id_args) with the line: mfinfo = None

Next we install the module

  1. Download the easy_install graphical installer from here
  2. Run the downloaded file, it should open a command line and finish the installation
    • The installed files should be located in C:\Path\To\Python\Folder\..\Scripts
  3. There are several different python modules, so note the name of the module you want to install. numPy will be installed here.
  4. Open a command prompt, by pressing the start button, and searching cmd
    • "Refer to adjacent text"
  5. At the prompt, type the full path to easy_install executable and the name of the python module you need. ie. C:\Path\To\Python\Folder\..\Scripts\easy_install.exe module_Name
    where module_Name is the name of the module, numPy in this case
    • "Refer to adjacent text"
    • Click to enlarge
  6. Finally, press enter to run and install the module

Popular Executable Modules

numPy
Can be installed with the installer found here
sciPy
Can be installed with the installer found here
iPython
Can be installed with the installer found here