Skip to content

Triangle Python Users Group: TriPython (formerly TriZPUG)

Sections
Personal tools
You are here: Home » Boot Camps » Wisconsin PyCamp™ 2014 » What To Do Before PyCamp

What To Do Before PyCamp

Document Actions
Following these instructions will prepare you for PyCamp. The hardest part of PyCamp is the non-Python part, where we have to install a few programs and change some settings in our operating systems to use the programs properly. Please set aside some time and accomplish these steps prior to coming to PyCamp so that you will benefit the most from being at PyCamp. You will be glad you did. Choose your operating system below as the instructions are different for Windows, OSX, and Linux. However, the instructions do result in all three platforms working as close to the same in class as is currently possible. And that will help the class go much more smoothly. You will need to be connected to the Internet in order for these instructions to work.

Windows • OSX • Linux

Problems? Please don't hesitate to ask for help from pycamp@trizpug.org.

Windows

Special Windows Note

Remember that the requirements for class specify that you must have an accessible administrative account on your Windows laptop. If you bring Windows to class without administrative access on your login id, you may not receive any support for these installation instructions. If you do not have a laptop with an accessible administrative account, you should make arrangements to get one before class.

You may cut and paste the commands listed in the instructions is that helps you. Enjoy it while you can. We will not use cut and paste in class.

Install Python

  1. Using a browser, download the Windows X86-64 MSI Installer (2.7.6) if you have 64 bit Windows. Download the Windows x86 MSI Installer (2.7.6) if you have 32 bit Windows. If you don't know which you have, look under Control Panel > System and Security > System > System Type.
  2. Using Windows File Explorer navigate to the folder where you downloaded the Python installer from python.org (your Downloads folder is usually \Users\youruserid\Downloads). Double click on the installer and accept all the default options.
  3. When the installer has finished, from the Windows Control Panel navigate to Control Panel > System and Security > System > Advanced System Settings > Environment Variables.
  4. Scroll through the System variables (not the user variables) to find the Path variable. Highlight the Parh variable by selecting it with your mouse. Click on Edit to edit the Path variable. If at anytime you think you have messed up, simply click Cancel and start over.
  5. Place your cursor in the Variable Value field for the Path variable and scroll to the end of the current value with your keyboard's arrow keys.
  6. Add the following to the end of the current value: ;C:\Python27; (be sure to include the first and last semicolon as shown). Then click OK three times to close all the dialogs and save the new Path variable value.
  7. Open a Windows Command Prompt. At the prompt type python (all lower case) and press the Enter key. You should see a Python Prompt start. To exit the Python prompt, hold down the control key and press Z. Then lift you finger from the control key and press the Enter key. To exit the Windows command prompt, type exit and press the Enter key. The Python prompt runs within the Windows command prompt.

Install Python For Windows Extensions

  1. Using a browser, download the Windows 64 bit Extensions for Python 2.7 if you have 64 bit Windows. Download the Windows 32 bit Extensions for Python 2.7 if you have 32 bit Windows.
  2. Using Windows File Explorer navigate to the folder where you downloaded the Python for Windows Extensions installer. Double click on the installer and accept all the default options.
  3. When the installer has finished, from the Windows Control Panel navigate to Control Panel > System and Security > System > Advanced System Settings > Environment Variables.
  4. Scroll through the System variables (not the user variables) to find the Path variable. Highlight the Parh variable by selecting it with your mouse. Click on Edit to edit the Path variable. If at anytime you think you have messed up, simply click Cancel and start over.
  5. Place your cursor in the Variable Value field for the Path variable and scroll to the end of the current value with your keyboard's arrow keys.
  6. Add the following to the end of the current value: C:\Python27\Scripts; (be sure to include the last semicolon as shown). Then click OK three times to close all the dialogs and save the new Path variable value.

Install Pip

Pip is an installer for Python packages from the Python Package Index.

  1. Using a browser, download the Pip installer.
  2. Open a Windows Command Prompt. Navigate to the directory into which you downloaded the Pip installer. You can usually do this by typing the command cd \Users\youruserid\Downloads and pressing the Enter key where youruserid is substituted with your Windows user ID.
  3. Type the command python get-pip.py and press the Enter key. This will download and install Pip into your Python installation. If you experience problems downloading Pip with this command, it is likely you are behind a network firewall that is causing a problem. You should find another network to use if that is the case.

Install Virtualenv

Virtualenv is a Python package for creating virtual Python environments. We will install it and use it to create a virtual Python environment for class.

  1. At the same Windows command prompt, type the command pip install virtualenv and press the Enter key.
  2. At the same Windows command prompt, type the command virtualenv \Users\youruserid\Desktop\pycamp and press the Enter key. You should see a folder called pycamp appear on your desktop.
  3. Navigate your Windows command prompt to the directory created for your virtual Python environment. You can usually do this by typing the command cd \Users\youruserid\Desktop\pycamp and pressing the Enter key.
  4. Type the dir command, press the Enter key, and you should see three subdirectories in the pycamp directory (Include, Lib, and Scripts).
  5. Type the command Scripts\activate, press the Enter key, and you should see the Windows command prompt change to show you are now within a virtual Python environment called pycamp.
  6. Type the command python (all lower case) and press the Enter key. You should see a Python Prompt start. To exit the Python prompt, hold down the control key and press Z. Then lift you finger from the control key and press the Enter key.
  7. To exit the virtual Python environment, type deactivate and press the Enter key. To exit the Windows command prompt, type exit and press the Enter key. The virtual Python prompt runs within a virtual Python environment which runs within the Windows command prompt.

Install Sublime Text 2

Sublime is a very popular advanced text editor which works the same on all platforms. It has special handling for Python scripts. We will use it in class to edit Python scripts.

  1. Using a browser, download the Sublime Text 2 for 64 bit Windows if you have 64 bit Windows. Download the Sublime Text 2 for 32 bit Windows if you have 32 bit Windows.
  2. Using Windows File Explorer navigate to the folder where you downloaded the Sublime Text 2 installer. Double click on the installer and accept all the default options except check the Add to Explorer Context Menu option when it appears.
  3. When the installer has finished, from the Windows Control Panel navigate to Control Panel > System and Security > System > Advanced System Settings > Environment Variables.
  4. Scroll through the System variables (not the user variables) to find the Path variable. Highlight the Parh variable by selecting it with your mouse. Click on Edit to edit the Path variable. If at anytime you think you have messed up, simply click Cancel and start over.
  5. Place your cursor in the Variable Value field for the Path variable and scroll to the end of the current value with your keyboard's arrow keys.
  6. Add the following to the end of the current value: "C:\Program Files7\Sublime Text 2"; (be sure to include the last semicolon as shown). Then click OK three times to close all the dialogs and save the new Path variable value.
  7. Open a Windows Command Prompt. Type the command sublime_text and press the Enter key. In a few seconds (it runs slower the first time) you will see a Sublime text editor open. Close the editor by pressing the red X icon on the top right of the editor.
  8. Find the icon you use to start the WIndows command prompt. Right click on it. Select "Run as Administrator." Click on Yes when the dialog asks if you want to allow the command prompt fo make changes to your computer.
  9. At the command prompt which opens, type mklink "%ProgramFiles%\Sublime Text 2\subl.exe" "%ProgramFiles%\Sublime Text 2\sublime_text.exe" and press the Enter key. You will see a message about a symbolic link created. Close the prompt by typing exit and pressing the Enter key.
  10. Open a new Windows command prompt the usual way without having to run as an administrator. Type the command subl and press the Enter key. You will see a Sublime text editor open. Close the editor by pressing the red X icon on the top right of the editor.
  11. You are now finished and ready for class!

OSX

Install XQuartz

Many Python tools require a more up to date version of X11 that what comes with OSX.

  1. Download and install XQuartz if you haven't already.

Install Xcode

Many Python tools require Xcode and Apple Command Line Tools. These are free from Apple's App Store.

  1. Open App Store.
  2. Type Xcode in the App Store's search box.
  3. Click on Xcode's "FREE" icon.
  4. After Xcode installs, an Xcode icon will appear on your Launchpad. Click on it.
  5. On the Xcode menu at the top of your screen, click on "Xcode."
  6. Click on "Preferences." Click on "Downloads" on the Preferences menu.
  7. If an "install" icon is present for Command Line Tools, click it.
  8. When the installation is complete, hold down the command key and type the letter q to close Xcode.

Install Iterm 2

iTerm2 is an advanced command terminal for OSX. It is much better than the command terminal which comes with OSX. It supports tabbed sessions and many other useful features. You will use it to run Python in class.

  1. Go to http://www.iterm2.com/.
  2. Click on "Download." Click on iTerm2_v1_0_0.zip.
  3. On the next page, click on iTerm2_v1_0_0.zip again.
  4. When the "Opening iTerm2_v1_0_0.zip" dialog appears, make sure "Save file" is clicked and then click "OK."
  5. After the download completes, open your Downloads folder.
  6. Double click on iTerm2_v1_0_0.zip.
  7. The zip expands leaving a iTerm.app in your Downloads folder. Drag and drop iTerm.app into your Applications folder.
  8. Drag and drop iTerm.app from your Applications folder to your Dock.

Install Python

Python 2.7 is already installed on OSX. You may use that version in class. However, because Apple's Python isn't the latest production version of Python 2.7, you may or not want to go to the trouble of installing a fresher Python using Homebrew if you are familiar with that project. Using Homebrew's Python will save you from having to separately install Pip. Follow the instructions at the Hitchhiker's Guide to Python if you prefer using a Python in class that is isolated from your system Python. It is usually less trouble to use Python from the Homebrew project than your built-in system Python.

Install Pip

Pip is an installer for Python packages from the Python Package Index. Do not follow this step if you used Hombrew to install Python.

  1. Using a browser, download the Pip installer.
  2. Click on the iTerm2 icon on your Dock.
  3. At the command prompt, navigate to the directory into which you downloaded the Pip installer. You can usually do this by typing the command cd /Users/youruserid/Downloads and pressing the Enter key where youruserid is substituted with your OSX user ID.
  4. Type the command sudo python get-pip.py and press the Enter key. Enter your login password when asked. This will download and install Pip into your default Python installation. If you experience problems downloading Pip with this command, it is likely you are behind a network firewall that is causing a problem. You should find another network to use if that is the case.

Install Virtualenv

Virtualenv is a Python package for creating virtual Python environments. We will install it and use it to create a virtual Python environment for class.

  1. Skip this one instruction if you have already installed virtualenv via the instructions at the Hitchhiker's Guide to Python, otherwise: at the same command prompt, type the command sudo pip install virtualenv and press the Enter key. Enter your login password when asked.
  2. At the same command prompt, type the command virtualenv /Users/youruserid/Desktop/pycamp and press the Enter key. You should see a folder called pycamp appear on your desktop.
  3. Navigate your command prompt to the directory created for your virtual Python environment. You can usually do this by typing the command cd /Users/youruserid/Desktop/pycamp and pressing the Enter key.
  4. Type the ls command, press the Enter key, and you should see three subdirectories in the pycamp directory (bin, include, and lib).
  5. Type the command source bin/activate, press the Enter key, and you should see the command prompt change to show you are now within a virtual Python environment called pycamp.
  6. Type the command python (all lower case) and press the Enter key. You should see a Python Prompt start. To exit the Python prompt, hold down the control key and press D.
  7. To exit the virtual Python environment, type deactivate and press the Enter key. To exit the command prompt, type exit and press the Enter key. The virtual Python prompt runs within a virtual Python environment which runs within the command prompt.

Install Sublime Text 2

Sublime is a very popular advanced text editor which works the same on all platforms. It has special handling for Python scripts. We will use it in class to edit Python scripts.

  1. Go to http://www.sublimetext.com/.
  2. Click on "Download."
  3. Click on "OS X."
  4. When the "Opening Sublime Text 2.0.2.dmg" dialog appears, make sure "Save file" is clicked and then click "OK."
  5. After the download completes, open your Downloads folder.
  6. Double click on Sublime Text 2.0.2.dmg.
  7. A Sublime Test 2 folder appears. Drag and drop the Sublime Text 2.app icon to the Applications icon in the folder.
  8. After Sublime Text 2.app finishes copying to Applications, close the Sublime Text 2 folder.
  9. Look on your desktop. Control-click on the Sublime Text 2 disk image icon. Click on "Eject Sublime Text 2."
  10. Sublime can start from an icon on your Launchpad. However, we want to be able to start it from a command line.
  11. Click on the iTerm2 icon on your Dock.
  12. At the command prompt, type cd ~ and press the enter key. You may cut and paste that command if that helps you.
  13. At the command prompt, type mkdir bin and press the enter key. You may cut and paste that command if that helps you.
  14. At the command prompt, type ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl and press the enter key. You may cut and paste that command if that helps you.
  15. At the command prompt, type bin/subl .profile and press the enter key. You may cut and paste that command if that helps you.
  16. A dialog may appear which says "Sublime Text 2 is an application downloaded from the Internet. Are your sure you want to open it?" Click "Open."
  17. After a couple of seconds, you will be looking at a Sublime editor window, You are editing a file called ".profile." The dot in front of the name ".profile" means it is a "hidden" file. It is a file of commands which execute every time you start a new command terminal.
  18. The file may already have some lines of commands in it. It may have many. However, if the .profile file is empty, hold down the command key and press the letter w to close the file. Do not save the file. Return to step 15, but type bin/subl .bash_profile and press enter instead of bin/subl .profile. Explanation: some instances of OSX use the .bash_profile configuration file instead of .profile.
  19. You need to add this command: export PATH=~/bin:$PATH on its own line in the Sublime editor window at the very end of the file. Blank lines in the file don't matter. So if you have blank lines around the line you add, that's OK.
  20. After adding the command to .profile (or .bash_profile is your system has no .profile), save the file by holding down the command key and type the letter s.
  21. Hold down the command key and type the letter q to close Sublime.
  22. In your command window, hold down the command key and type the letter t to open a command prompt in a new tab.
  23. At the new command prompt, type subl and press the enter key. Sublime opens with the last file you edited (.profile) in the Sublime editor window. Sublime remembers what files you were editing from session to session.
  24. In the Sublime editor window, hold down the command key and type the letter q to close Sublime.
  25. In the iTerm2 window, hold down the command key and type the letter q to close all the tabbed terminal sessions. Click "OK" to confirm.
  26. You are now finished and ready for class!

Linux

Install Python

Python is already installed on all Linux systems because the tools used to install and administer Linux are written in Python. You can use the built-in Python in class.

Install Pip

Pip is an installer for Python packages from the Python Package Index. Do not follow this step if you used Hombrew to install Python.

  1. Using a browser, download the Pip installer.
  2. Open a command terminal.
  3. At the command prompt, navigate to the directory into which you downloaded the Pip installer. You can usually do this by typing the command cd $HOME/Downloads and pressing the Enter key.
  4. Type the command sudo python get-pip.py and press the Enter key. Enter your login password when asked. This will download and install Pip into your default Python installation. If you experience problems downloading Pip with this command, it is likely you are behind a network firewall that is causing a problem. You should find another network to use if that is the case.

Install Virtualenv

Virtualenv is a Python package for creating virtual Python environments. We will install it and use it to create a virtual Python environment for class.

  1. At the same command prompt, type the command sudo pip install virtualenv and press the Enter key. Enter your login password when asked.
  2. At the same command prompt, type the command virtualenv $HOME/Desktop/pycamp and press the Enter key. You should see a folder called pycamp appear on your desktop.
  3. Navigate your command prompt to the directory created for your virtual Python environment. You can usually do this by typing the command cd $HOME/Desktop/pycamp and pressing the Enter key.
  4. Type the ls command, press the Enter key, and you should see three subdirectories in the pycamp directory (bin, include, and lib).
  5. Type the command source bin/activate, press the Enter key, and you should see the command prompt change to show you are now within a virtual Python environment called pycamp.
  6. Type the command python (all lower case) and press the Enter key. You should see a Python Prompt start. To exit the Python prompt, hold down the control key and press D.
  7. To exit the virtual Python environment, type deactivate and press the Enter key. To exit the command prompt, type exit and press the Enter key. The virtual Python prompt runs within a virtual Python environment which runs within the command prompt.

Install Sublime Text 2

Sublime is a very popular advanced text editor which works the same on all platforms. It has special handling for Python scripts. We will use it in class to edit Python scripts.

  1. Go to http://www.sublimetext.com/.
  2. Click on "Download."
  3. Click on "Linux 32 bit."
  4. When the "Opening Sublime Text 2.0.2.tar.bz" dialog appears, make sure "Save file" is clicked and then click "OK."
  5. After the download completes, open a command terminal.
  6. At the terminal prompt, type cd ~/Downloads and press the enter key. You may cut and paste that command if that helps you.
  7. At the command prompt, type tar -xjvf Sublime\ Text\ 2.0.2.tar.bz2 and press the enter key. You may cut and paste that command if that helps you.
  8. At the terminal prompt, type cd ~ and press the enter key. You may cut and paste that command if that helps you.
  9. At the command prompt, type mkdir bin and press the enter key. You may cut and paste that command if that helps you.
  10. At the command prompt, type ln -s $HOME/Downloads/Sublime\ Text\ 2/sublime_text ~/bin/sublime and press the enter key. You may cut and paste that command if that helps you.
  11. At the command prompt, type bin/sublime .bashrc and press the enter key. You may cut and paste that command if that helps you.
  12. After a couple of seconds, you will be looking at a Sublime editor window, You are editing a file called ".bashrc" and the dot in front of the name ".bashrc" means it is a "hidden" file. It is a file of commands which execute every time you start a new command terminal.
  13. The file may already have some lines of commands in it. It may have many. However, if the .bashrc file is empty, hold down the command key and press the letter w to close the file. Do not save the file. Return to step 11, but type bin/sublime .profile and press enter instead of bin/sublime .bashrc. Explanation: some distributions of Linux use the .profile configuration file instead of .bashrc.
  14. You need to add this command: export PATH=~/bin:$PATH on its own line in the Sublime editor window at the very end of the file. Blank lines in the file don't matter. So if you have blank lines around the line you add, that's OK.
  15. After adding the command to .bashrc (or .profile is your system has no .bashrc), save the file by holding down the control key and type the letter s.
  16. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  17. In your command window, hold down the shift and control keys and type the letter t to open a command prompt in a new tab.
  18. At the new command prompt, type sublime and press the enter key. Sublime opens with the last file you edited (.bashrc) in the Sublime editor window. Sublime remembers what files you were editing from session to session.
  19. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  20. At the command prompt, type sublime bin/subl and press the enter key. You may cut and paste that command if that helps you.
  21. Type the following line exactly as shown into the Sublime editor window for bin/subl. You may cut and paste them if that helps you:
    nohup sublime $@ &> /dev/null &
    
  22. Hold down the control key and type the letter s to save bin/subl.
  23. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  24. At the new command prompt, type chmod +x bin/subl and press the enter key.
  25. At the new command prompt, type subl and press the enter key. Sublime now opens without holding up a command terminal session. The command terminal can be closed and Sublime will still be running.
  26. In the terminal window, click on the "X" in the top right corner to close all the tabbed terminal sessions.
  27. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  28. You are now finished and ready for class!