Skip to content

Triangle Python Users Group: TriPython (formerly TriZPUG)

Sections
Personal tools
You are here: Home » Boot Camps » Wisconsin Mini-PyCamp™ 2013 » 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.

Windows • OSX • Linux

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

Windows

Install Canopy Express

Canopy Express is a free Python "super distribution." It includes the standard Python distribution from python.org plus many other tools which can be troublesome to install on their own. You will use some of these tools in class. Canopy Express is also safe to install if you have other versions of Python installed on you system.

  1. Go to https://enthought.com/.
  2. Hover over "Products." Click on "Enthought Canopy."
  3. Click on "Get Canopy." Click on "Download" under "Enthought Canopy Express Free."
  4. Click on "Download Canopy 1.0, 32-bit for WIndows."
  5. When the "Opening canopy-1.0.0-win-32.msi" dialog appears, click "Save File."
  6. After the download completes, open your Downloads folder.
  7. Double click on canopy-1.0.0-win-32.msi
  8. When the "Open File - Security Warning" dialog appears asking "Do you want to run this file?," click "Run."
  9. When the "Welcome to the Enthought Canopy (32-bit) Setup Wizard" appears, click "Next."
  10. Accept the license agreement and click "Next."
  11. On the "Installation Scope" dialog, click "Next."
  12. On the "Ready to Install" dialog, click "Next."
  13. When the installation wizard complete, click "Finish."
  14. After several seconds to a minute or more, a "Setting up your Canopy environment" dialog appears. Leave "Use Canopy as my default Python environment" checked. When the set up completes, click "Start Using Canopy."
  15. After several more seconds, a "Welcome to Canopy" dialog appears.
  16. Click on the Canopy "Help" menu. Click on "Software Updates."
  17. Canopy will download a couple of updates. When they have finished downloading, click on "Install and Relaunch."
  18. After Canopy relaunches, close it by clicking on the "X" in the top right corner. We won't be using the Canopy editor, package manager, or doc browser. You won't need an Enthought account.
  19. Click on the Windows "Start" menu.
  20. Click on "All Programs."
  21. Click on "Accessories."
  22. Click on "Command Prompt." We will be using the command prompt a lot at PyCamp. You may want to pin it to your Windows task bar and/or start menu.
  23. A command prompt window appears.
  24. At the command prompt, type cd %HOMEPATH% and press the enter key. You may cut and paste that command if that helps you.
  25. At the command prompt, type venv -s %HOMEPATH%\Desktop\pycamp and press the enter key. You may cut and paste that command if that helps you.
  26. In a couple of seconds, the venv command completes and control returns to the command prompt.
  27. At the command prompt, type %HOMEPATH%\Desktop\pycamp\Scripts\activate.bat and press the enter key. You may cut and paste that command if that helps you. You will type that command every time you open a command prompt during PyCamp.
  28. You will see the command prompt change so that it starts with "(pycamp)."
  29. This step depends on whether you are using Internet Explorer for your browser or another browser such as Firefox or Chrome. It is highly recommended that you use the free and open source Firefox browser for PyCamp.

    For Firefox or Chrome:

    1. In your non-Internet Explorer web browser, go to http://raw.github.com/pypa/pip/master/contrib/get-pip.py.
    2. If the file appears as text in your brower instead of downloading, right click on the page and select "Save Page As..." On the "Save As" dialog which appears, select your Downloads folder as the destination. Select "All Files" from the "Save as type" drop down menu. Then click "Save."

    For Internet Explorer:

    1. In Internet Explorer, go to https://github.com/pypa/pip/blob/develop/contrib/get-pip.py.
    2. Locate the button on the page labelled "Raw."
    3. Right-click on that button.
    4. Select "Save Target As..." on the right-click menu. On the "Save As" dialog which appears, select your Downloads folder as the destination. Select "All Files" from the "Save as type" drop down menu. Then click "Save."
  30. Back at your command prompt, type python Downloads\get-pip.py and press the enter key. You may cut and paste that command if that helps you. You will see messages fly by about downloading, running, warning, and installing; finally ending with "Successfully installed pip" and "Cleaning up..."
  31. Type python in all lowercase at the command prompt and press the enter key.
  32. You are now in your own virtual private Python interpreter.
  33. At the ">>>" Python prompt, type 2 + 3 and press the enter key. You will see the answer "5."
  34. Hold down the control key and type the letter z to exit the Python interpreter.
  35. At the command prompt, type set PATH and press the enter key. PATH is all uppercase. You will see a list of directories separated by semicolons. The PATH is the list of directories Windows searches for programs. When you enter the command "python," Windows looks at each of the directories in the PATH in order until it finds the python command. You should see the Scripts folder in your pycamp folder on your Desktop as the first directory in the list. This is just so you know where your Python is. The activate.bat script you ran in a step above was responsible for putting %HOMEPATH%\Desktop\pycamp\Scripts first in the PATH search order.
  36. Type exit and press the enter key to exit the command terminal.
  37. If you open a command prompt again, don't forget to type %HOMEPATH%\Desktop\pycamp\Scripts\activate.bat and press the enter key. Otherwise you will not be using the pycamp virtual private Python on your desktop. You will add a batch file in the next procedure to make this step easier.

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 "Windows."
  4. When the "Opening Sublime Text 2.0.1 Setup.exe" dialog appears, click "Save File."
  5. After the download completes, open your Downloads folder.
  6. Double click on Sublime Text 2.0.1 Setup.exe.
  7. When the "Open File - Security Warning" dialog appears asking "Do you want to run this file?," click "Run."
  8. When the "Welcome to the Sublime Text 2 Setup Wizard" appears, click "Next."
  9. On the "Select Destination Location" panel, click "Next" to accept the default.
  10. On the "Select Additional Tasks" panel, select "Add to explorer context menu" and click "Next."
  11. On the "Ready to Install" panel, click "Install."
  12. When the installation completes, click "Finish."
  13. Click on the Windows "Start" menu.
  14. Click on "All Programs."
  15. Click on "Accessories."
  16. Click on "Command Prompt." We will be using the command prompt a lot at PyCamp. You may want to pin it to your Windows task bar and/or start menu.
  17. A command prompt window appears.
  18. At the command prompt, type cd %HOMEPATH% and press the enter key. You may cut and paste that command if that helps you.
  19. At the command prompt, type notepad act.bat and press the enter key.
  20. A dialog appears which says "Cannot find the act.bat file. Do you want to create a new file?" Click "Yes."
  21. Type the following four lines exactly as shown into the Notepad window. You may cut and paste them if that helps you:
    @echo off
    set PATH="C:\Program Files\Sublime Text 2";%PATH%
    set PATH="C:\Program Files (x86)\Sublime Text 2";%PATH%
    %HOMEPATH%\Desktop\pycamp\Scripts\activate.bat
    
    It is very important to use Notepad for this step. Other editors may insert Unix line endings into the act.bat file, causing the batch file to fail when run.
  22. Hold down the control key and type the letter s to save act.bat.
  23. Click on the "X" in the top right corner to close notepad.
  24. Back at the command prompt, type act.bat and press the enter key.
  25. The batch file did two things for you. It activated your virtual private Python. And it put sublime_text.exe in your PATH. Use act.bat each time you open a new command prompt in class.
  26. Try Sublime after running act.bat by typing sublime_text act.bat at the command prompt. In case you can't see it, there is an under-bar, not a space, between "sublime" and "text" in that command. You will type more under-bars that you've ever typed before in class.
  27. A Sublime text editor appears with the same act.bat file you edited in notepad. Except it looks much nicer in Sublime. Different parts of the command are colorized. It does the same thing for Python scripts, as you will see in class.
  28. Close Sublime by clicking on "File" in the editor menu and then clicking on "Exit."
  29. The next time you open Sublime, it will remember which files you were editing previously and open them. Sublime allows you to edit several files at once in tabs.

OSX

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. Click on the "install" icon for Command Line Tools.
  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 Canopy Express

Canopy Express is a free Python "super distribution." It includes the standard Python distribution from python.org plus many other tools which can be troublesome to install on their own. You will use some of these tools in class. Canopy Express is also safe to install if you have other versions of Python installed on you system.

  1. Go to https://enthought.com/.
  2. Hover over "Products." Click on "Enthought Canopy."
  3. Click on "Get Canopy." Click on "Download" under "Enthought Canopy Express Free."
  4. Click on "Download Canopy 1.0, 32-bit for Mac OS X."
  5. When the "Opening canopy-1.0.0-osx-32.dmg" dialog appears, make sure "Save file" is clicked and then click "OK."
  6. After the download completes, open your Downloads folder.
  7. Double click on canopy-1.0.0-osx-32.dmg.
  8. An Enthought folder appears. Drag and drop the Canopy.app icon to the Applications icon in the folder.
  9. After Canopy.app finishes copying to Applications, close the Enthought folder.
  10. Look on your desktop. Control-click on the Enthought disk image icon. Click on "Eject Enthought."
  11. A Canopy icon is now on your Launchpad. Click on it.
  12. A dialog may appear which says "Canopy is an application downloaded from the Internet. Are your sure you want to open it?" Click "Open."
  13. Or, a dialog may appear which says, ""Canopy can't be opened because it is from an unidentified developer." If you see this, open your Applications folder in the Finder. Hold down the control key, and click once on the Canopy icon. This will bring up a context menu. In the context menu, choose "Open". It will ask, "Canopy is from an unidentified developer. Are you sure you want to open it?" Click "Open".
  14. A dialog appears informing you of Canopy set up. Leave "Use Canopy as my default Python environment" checked. Click on "Start using Canopy."
  15. A "Welcome to Canopy" dialog appears.
  16. Click on the Canopy "Help" menu. Click on "Software Updates."
  17. Canopy will download a couple of updates. When they have finished downloading, click on "Install and Relaunch."
  18. After Canopy relaunches, hold down the command key and type the letter q to close it. We won't be using the Canopy editor, package manager, or doc browser. You won't need an Enthought account.
  19. Click on the iTerm2 icon on your Dock. A command terminal appears. The command prompt of the terminal should start with "(Canopy 32bit)."
  20. At the command prompt, type cd ~ and press the enter key. You may cut and paste that command if that helps you.
  21. At the command prompt, type python in all lowercase and press the enter key.
  22. You are now in the Python interpreter. Hold down the control key and type the letter d to exit the Python interpreter.
  23. Type exit and press the enter key to exit the command terminal.
  24. Hold down the command key and type the letter q to close iTerm2.

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." Don't worry; it also works on 10.8.
  4. When the "Opening Sublime Text 2.0.1.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.1.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. But because you just installed Canopy Express, it could have at least two lines and those two lines are at the very end of the file. The first of those two lines starts with "# Added by Canopy installer."
  19. 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. If Canopy finds the .bash_profile file instead of the .profile file, it will put its "# Added by Canopy installer." lines in .bash_profile.
  20. You need to add this command: export PATH=~/bin:$PATH on its own line in the Sublime editor window. The line you add needs to go on a line right before the line at the bottom of the file which says "# Added by Canopy installer." Blank lines in the file don't matter. So if you have blank lines around the line you add, that's OK.
  21. 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.
  22. Hold down the command key and type the letter q to close Sublime.
  23. In your command window, hold down the command key and type the letter t to open a command prompt in a new tab.
  24. 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.
  25. In the Sublime editor window, hold down the command key and type the letter q to close Sublime.
  26. 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.

Configure Your Virtual Private Python

We will set up a Python environment to use in class that we can mess up or damage, then delete and start over.

  1. Click on the iTerm2 icon on your Dock.
  2. At the command prompt, type cd ~ and press the enter key. You may cut and paste that command if that helps you.
  3. At the command prompt, type venv -s Desktop/pycamp and press the enter key. You may cut and paste that command if that helps you.
  4. At the command prompt, type deactivate and press the enter key. You will see the command prompt change so that it no longer begins with "(Canopy 32bit)."
  5. At the command prompt, type . Desktop/pycamp/bin/activate and press the enter key. Don't forget the dot and space at the beginning of the command. You may cut and paste that command if that helps you. You will see the command prompt change so that it starts with "(pycamp)."
  6. At the command prompt, type easy_install pip and press the enter key. You may cut and paste that command if that helps you. You will see some messages about searching, reading, downloading, processing, writing, running, warning, adding, and installing; ending with a message "Finished processing dependencies for pip."
  7. Type python in all lowercase at the command prompt and press the enter key.
  8. You are now in your own virtual private Python interpreter.
  9. At the ">>>" Python prompt, type 2 + 3 and press the enter key. You will see the answer "5."
  10. Hold down the control key and type the letter d to exit the Python interpreter.
  11. After exiting Python, type which python to see where your virtual private Python interpreter is located on your file system. For me that is "/Users/cbc/Desktop/pycamp/bin/python" because my login ID on my laptop is cbc. For you it will be different, with "cbc" replaced by your login ID. "/Users/cbc/Desktop/pycamp/bin" is the directory where the "python" program is. We need to make this more permanent.
  12. At the command prompt, type subl .profile to edit your command terminal profile again.
  13. At the bottom of the Sublime editor window for the .profile file, you should see a line that starts with the command "source" and then has some long location of the Canopy Express virtual private python activation file (known as "activate") such as "/Users/cbc/Library/Enthought/Canopy_32bit/User/bin/activate." For you it will be different, with "cbc" replaced by your login ID. You need to replace the location of the activation file with location you saw in the "which" command above. When I changed mine, the line which previously said source /Users/cbc/Library/Enthought/Canopy_32bit/User/bin/activate was changed to source /Users/cbc/Desktop/pycamp/bin/activate. For you it will be different, with "cbc" replaced by your login ID. You may cut the output of the "which" command up to where it says "python> and paste/replace the "source" location up to where it says "activate" in the Sublime editor window for .profile if that helps you. In case you can't see it, there is an under-bar, not a space, between "Canopy" and "32bit" in the original activation file location. You will type more under-bars that you've ever typed before in class.
  14. After changing the command in .profile, save the file by holding down the command key and type the letter s.
  15. Hold down the command key and type the letter q to close Sublime.
  16. In your command window, hold down the command key and type the letter t to open a command prompt in a new tab.
  17. The command prompt you see in the new command terminal session should now start with "(pycamp)."
  18. Type exit and press the enter key to exit the command terminal.
  19. Hold down the command key and type the letter q to close iTerm2.

Linux

Install Canopy Express

Canopy Express is a free Python "super distribution." It includes the standard Python distribution from python.org plus many other tools which can be troublesome to install on their own. You will use some of these tools in class. Canopy Express is also safe to install if you have other versions of Python installed on you system.

  1. Go to https://enthought.com/.
  2. Hover over "Products." Click on "Enthought Canopy."
  3. Click on "Get Canopy." Click on "Download" under "Enthought Canopy Express Free."
  4. On the "Pick your flavor" tab, select "32-bit" unless you have 64-bit Linux. If you have 64-bit Linux and you have problems with these instructions using 32-bit Canopy, you may use 64-bit Canopy. However, the class exercises are in 32 bits as 32 bits is the flavor of Canopy which is presently free for Windows and OSX. It is possible to install 32-bit Canopy on 64-bit Linux if all correct 32-bit libraries are installed on your Linux. However, getting them installed if they aren't present is outside the scope of these instructions. And so 64-bit Canopy for Linux will be permitted for class if necessary for you. You will need to make the necessary adjustments in the following instructions for 32-bit versus 64-bit Canopy.
  5. Click on "Download Canopy 1.0, 32-bit for Linux Beta."
  6. When the "Opening canopy-1.0.0-rh5-32.sh" dialog appears, make sure "Save file" is clicked and then click "OK."
  7. After the download completes, open a command terminal. If you use Linux, you surely know how to open a command terminal. But if not, you can find it either under your Applications/System Tools menu or by right clicking your desktop and selecting "Open in Terminal."
  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 terminal prompt, type chmod +x Downloads/canopy-1.0.0-rh5-32.sh and press the enter key. You may cut and paste that command if that helps you.
  10. At the terminal prompt, type Downloads/canopy-1.0.0-rh5-32.sh and press the enter key. You may cut and paste that command if that helps you.
  11. When the script says "Press Enter to continue," press the enter key.
  12. You may scroll in one direction by one line at a time through the license agreement by pressing or holding the enter key. When you get tired of reading, you may type the letter q to quit reading. If you scroll all the way to the end by holding down the enter key for a long time, you will likely need to run the script again unless you are very, very good at knowing where to stop.
  13. Type yes to accept the click-through license agreement. As you are probably already aware, nobody gets to use software without agreeing to the license. C'est la vie.
  14. Press the enter key to install Canopy in your home directory.
  15. When the script finishes, type Canopy/canopy at the command prompt. You may see some warnings and errors. Fret not.
  16. A dialog appears informing you of Canopy set up. Leave "Use Canopy as my default Python environment" checked. Click on "Start using Canopy."
  17. A "Welcome to Canopy" dialog appears.
  18. Click on the Canopy "Help" menu. Click on "Software Updates."
  19. Canopy will download a couple of updates. When they have finished downloading, click on "Install and Relaunch."
  20. After Canopy relaunches, close it by clicking on the "X" in the top right corner. We won't be using the Canopy editor, package manager, or doc browser. You won't need an Enthought account.
  21. After Canopy closes, you may need to press the enter key in the terminal window to get back to a command prompt.
  22. At the command prompt, type . Enthought/Canopy_32bit/User/bin/activate and press the enter key. In case you can't see it, there is an under-bar, not a space, between "Canopy" and "32bit." in that command. You will type more under-bars that you've ever typed before in class. Don't forget the dot and space at the beginning of the command. You may cut and paste that command if that helps you. You will see the command prompt change so that it starts with "(Canopy 32bit)."
  23. At the command prompt, type python in all lowercase and press the enter key.
  24. You are now in the Python interpreter. Hold down the control key and type the letter d to exit the Python interpreter.
  25. Type exit and press the enter key to exit the command terminal.

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.1.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.1.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 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." 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. The file will already have some lines of commands in it. It may have many.
  13. 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 .bashrc file. Blank lines in the file don't matter. So if you have blank lines around the line you add, that's OK.
  14. After adding the command to .bashrc, save the file by holding down the control key and type the letter s.
  15. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  16. 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.
  17. 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.
  18. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  19. At the command prompt, type sublime bin/subl and press the enter key. You may cut and paste that command if that helps you.
  20. 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 &
    
  21. Hold down the control key and type the letter s to save bin/subl.
  22. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  23. 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.
  24. In the terminal window, click on the "X" in the top right corner to close all the tabbed terminal sessions.
  25. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."

Configure Your Virtual Private Python

We will set up a Python environment to use in class that we can mess up or damage, then delete and start over.

  1. Open a command terminal.
  2. At the command prompt, type cd ~ and press the enter key. You may cut and paste that command if that helps you.
  3. At the command prompt, type . Enthought/Canopy_32bit/User/bin/activate as before and press the enter key. Don't forget the dot and space at the beginning of the command. You may cut and paste that command if that helps you. You will see the command prompt change so that it starts with "(Canopy 32bit)."
  4. At the command prompt, type venv -s $HOME/Desktop/pycamp and press the enter key. You may cut and paste that command if that helps you.
  5. At the command prompt, type deactivate and press the enter key. You will see the command prompt change so that it no longer begins with "(Canopy 32bit)."
  6. At the command prompt, type . Desktop/pycamp/bin/activate and press the enter key. Don't forget the dot and space at the beginning of the command. You may cut and paste that command if that helps you. You will see the command prompt change so that it starts with "(pycamp)."
  7. At the command prompt, type easy_install pip and press the enter key. You may cut and paste that command if that helps you. You will see some messages about searching, reading, downloading, processing, writing, running, warning, adding, and installing; ending with a message "Finished processing dependencies for pip."
  8. Type python in all lowercase at the command prompt and press the enter key.
  9. You are now in your own virtual private Python interpreter.
  10. At the ">>>" Python prompt, type 2 + 3 and press the enter key. You will see the answer "5."
  11. Hold down the control key and type the letter d to exit the Python interpreter.
  12. After exiting Python, type which python to see where your virtual private Python interpreter is located on your file system at "~/Desktop/pycamp/bin/python" in your home directory. "~/Desktop/pycamp/bin" is the directory where the "python" program is. We need to make this more permanent.
  13. At the command prompt, type subl .bashrc to edit your command terminal profile again.
  14. At the bottom of the Sublime editor window for the .bashrc file, you need to add this command: source ~/Desktop/pycamp/bin/activate on its own line in the Sublime editor window at the very end of the .bashrc file, below the last line you added previously to export PATH. Again, 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 source command in .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 command key and type the letter t to open a command prompt in a new tab.
  18. The command prompt you see in the new command terminal session should now start with "(pycamp)."
  19. At the command prompt, type subl .bash_profile to edit your command terminal profile again.
  20. At the bottom of the Sublime editor window for the .bash_profile file, you need to delete the two lines added buy the Canopy installer. One line is a comment starting with a hash mark (#) and the next line is a source command. Place the cursor in the edit window at the beginning of the commnet line. Hold down the shift key and press the down arrow key twice to mark the two lines. Then hold down the control key and type the letter x to cut the two lines from the file.
  21. After deleting the comment and source command in .bash_profile, save the file by holding down the control key and type the letter s.
  22. Close Sublime by clicking on "File" in the editor menu and then clicking on "Quit."
  23. In the terminal window, click on the "X" in the top right corner to close all the tabbed terminal sessions.
  24. It helps to know the difference between .bashrc and .bash_profile.