PythonBasics Of Python
Python Setup and Help Function
This lecture guides how to set up Python on Windows, configure its system path, and use the help() function for documentation.
1. Verifying Python Installation
You can check if Python is installed and view its version using the Command Prompt (CMD):
python # Opens Python interpreter if installed
python --version # Displays installed Python version
2. Python Installation Path
Python is installed in:
C:\Python27
orC:\Python34
(older versions)- Or in the user directory:
C:\Users\<username>\AppData\Local\Programs\Python\Python34\python.exe
Copy the full path to
python.exe
for setting the system environment variable.
3. Setting Python Path in Windows
a) Temporary Path Setup (CMD session only)
- Open Command Prompt.
- Set the path using the command:
set path=C:\Users\<username>\AppData\Local\Programs\Python\Python34
- Verify Python:
python
>>> 2 + 3
5
>>> print("Hello World")
Hello World
This path will only remain active for the current CMD session.
b) Permanent Path Setup (Environment Variable)
- Right-click My Computer → select Properties.
- Click Advanced System Settings.
- Click Environment Variables.
- Under System Variables, find and select
Path
→ click Edit → New. - Paste the Python executable path:
C:\Users\<username>\AppData\Local\Programs\Python\Python34
- Click OK on all dialogs.
- Restart CMD (or your PC) and type:
python
If Python launches successfully, the setup is complete.
4. Using the help()
Function in Python
Python provides a built-in help system to access documentation for modules, functions, keywords, and topics.
Accessing Help
help() # Opens interactive help system
help> topics # Displays general Python topics
help> modules # Lists available modules
help> keywords # Shows all Python keywords
help> quit # Exit the help system
Help on Specific Topics
help('list') # Displays detailed information about lists
help('modules') # Shows installed modules
The
help()
function is essential for exploring Python’s built-in features and documentation interactively.
Summary
- Verify Python installation using
python
orpython --version
in CMD. - Temporary path → set using
set path=<python_path>
in CMD. - Permanent path → add Python executable to System Environment Variables.
- Use
help()
to explore Python topics, modules, keywords, and functions interactively. - Proper path setup ensures Python works seamlessly from any CMD session.