Fresh From #nicar12, Here Are Curated Notes to Set Up a Windows 7 Python Environment So I Can Practice at Work

The following are bullet points gathered from walkthroughs created by Anthony DeBarros and the Kenneth Reitz’s Python Guide to get a Python development environment up and running on my work machine.

I needed admin rights for only two steps:

  • Python 2.7.2 installation (Don’t install 3.1)
  • Setting the Python path

Once those steps are completed, these steps will get easy_install pip, virtualenv, django and many other packages up and running.

Download Distribute for Windows and save the script to your Python27 directory.

Open your command prompt by clicking Start Menu and search for cmd to find cmd.exe. You will change into the Python27 directory and run the distribute setup.py script. In turn, you will be able to install pip which is really the gateway drug to adding packages and learning your way.

cd C:\
cd C:\Python27
python distribute_setup.py
easy_install pip
pip install virtualenv

My virtual environments exist inside of C:\Python27\Scripts, so to get there, change to that directory and create a new virtual environment.

cd Scripts
virtualenv --distribute <environment name>

To activate virtual environment:

cd <environment name>
cd Scripts
activate.bat

From here, you can use pip to install python packages to the virtual environment

pip install django
pip install csvkit
pip install BeautifulSoup
pip install mechanize

To deactivate a virtual environment

deactivate

My next goal is to get a version of virtualenvwrapper running, which makes managing virtual environments a piece of cake.

Comments