In the following blog, i’ll shared the basic knowledge of getting started install python, environment setup. Easy_install and Virtual environment preparation.
Setting up environment in window XP
-
From the system variables, click "New" button.
-
Enter "PYTHON26" as variable name.
-
Enter "C:\Python26\python.exe" as variable value (base on ur installation path). Click Ok to close the window.
-
From the system variables, find the "PATH" and click edit
-
Move your cursor to the end, append the ";" and,
-
Append the "C:\Python26;" right after the ";"
-
Append the "C:\Python26\scripts;" right after the step 7.
Easy Install
1) If you are from java background, easy_install is library management framework like (maven).
2) Download “easy_install” tools from here. (double click and install)
3) By default, “easy_install” will create a folder called “Script” inside C:\python26\
4) Add additional “C:\Python26\Script;” into the system path (optional for virtual_environment)
More example: Part 1, and part 2
Virtualenv
Install the “virtualenv” run command:
-
C:\> easy_install virtualenv
Create the virtualenv folder, (you cannot relocated this folder later, extra step is needed)
-
C:\python-workspace
-
run command C:\python-workspace>virtualenv virtual_env
Start run ur environment, go to
-
C:\python-workspace\virtual_env\scripts>active.bat — OR deactivate –
-
C:\python-workspace\virtual_env\scripts>deactive.bat
Once u had activate the virtual environment, your command prompt should append (virtual_env) this in front.
-
(virtual_env) C:\python-workspace\virtual_env\Scripts>python
Once your start work on your new created python virtual environment, “easy_install” new library wont be shared with the parent python C:\python26. For instance, from your command prompt, we install python test library ‘nose’
-
(virtual_env) C:\python-workspace\virtual_env\Scripts>easy_install nose
How to prove it? from your command prompt, type ‘python’ to enter program mode, then ‘import nose’. It should give u no error.
Open another command prompt, type python. and type the same command ‘import nose’. It should give u error No module named nose.
Yeah, for the first step we had finnish setup the environment. We will come back later to install the require libs.
Done!
Back to test-automation contents.

Posted in 


