Difference between revisions of "Python-for-Automation/C2/Setup-Python-Environment-for-Automation/English"
| Line 1: | Line 1: | ||
| − | + | ||
{| border="1" | {| border="1" | ||
|- | |- | ||
| Line 6: | Line 6: | ||
|| '''Narration''' | || '''Narration''' | ||
|- | |- | ||
| − | + | ||
|| Show slide: | || Show slide: | ||
'''Welcome''' | '''Welcome''' | ||
| − | || Welcome to the Spoken Tutorial on ''' | + | || Welcome to the Spoken Tutorial on ''' Setup Python environment for Automation'''. |
| − | |- | + | |- |
|| Show slide: | || Show slide: | ||
'''Learning Objectives''' | '''Learning Objectives''' | ||
| − | || In this tutorial, we will learn how to | + | || In this tutorial, we will learn how to, |
* Install''' Python 3.12.3 '''in''' Ubuntu''' and '''Windows OS.''' | * Install''' Python 3.12.3 '''in''' Ubuntu''' and '''Windows OS.''' | ||
| Line 21: | Line 21: | ||
* Install necessary libraries required for automation. | * Install necessary libraries required for automation. | ||
| − | |- | + | |- |
|| Show slide: | || Show slide: | ||
| Line 29: | Line 29: | ||
* '''Windows 11''' | * '''Windows 11''' | ||
| − | |- | + | |- |
|| Show slide: | || Show slide: | ||
| Line 39: | Line 39: | ||
* '''Python''' | * '''Python''' | ||
| − | |- | + | |- |
| − | || | + | || Show slide: |
| + | |||
| + | '''Prerequisite''' | ||
|| | || | ||
* For pre-requisite '''Linux''' and '''Python''' tutorials, please visit this website. | * For pre-requisite '''Linux''' and '''Python''' tutorials, please visit this website. | ||
| − | |- | + | |- |
|| Show slide: | || Show slide: | ||
'''Code files''' | '''Code files''' | ||
|| | || | ||
| − | * | + | * The files used in this tutorial are provided in the '''Code files''' link. |
| − | * | + | * Please download and extract the files. |
| − | * | + | * Make a copy and then use them while practicing. |
| − | |- | + | |- |
|| Show slide: | || Show slide: | ||
'''Automation ''' | '''Automation ''' | ||
|| | || | ||
| − | * | + | * Automation is the use of technology to perform tasks with minimal human intervention. |
| − | * | + | * It automates repetitive tasks to save time and reduce errors. |
| − | * | + | * It provides uniformity in operations and saves time. |
| − | |- | + | |- |
| − | || | + | || Point to the files in the downloads folder |
| − | + | ||
| − | Point to the files in the downloads folder | + | |
Open '''Python_installation_linux.txt''' | Open '''Python_installation_linux.txt''' | ||
| Line 79: | Line 79: | ||
'''packages.txt '''file contains the library names used in the Python for Automation series. | '''packages.txt '''file contains the library names used in the Python for Automation series. | ||
| − | |- | + | |- |
| − | || | + | || Press '''Ctrl''', '''Alt''' and '''T keys'''. |
| − | + | || Now let us open the terminal window by pressing ''Ctrl''', '''Alt''' and '''T keys''' together. | |
| − | ''' | + | |- |
| − | || | + | |
| − | |- | + | |
|| '''>'''Type '''sudo apt update''' | || '''>'''Type '''sudo apt update''' | ||
| − | Press | + | Press Enter |
|| Now type '''sudo space apt space update '''and press '''Enter.''' | || Now type '''sudo space apt space update '''and press '''Enter.''' | ||
This command refreshes the local package index with the latest repository data. | This command refreshes the local package index with the latest repository data. | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''python3 --version ''' |
| − | + | ||
| − | '''>'''Type '''python3 --version ''' | + | |
| − | Press | + | Press Enter. |
|| Next type '''python3 space hyphen hyphen version.''' | || Next type '''python3 space hyphen hyphen version.''' | ||
You can see the version of python in your system. | You can see the version of python in your system. | ||
| − | |- | + | |- |
|| Highlight '''Python 3.12.3''' | || Highlight '''Python 3.12.3''' | ||
|| Here it is '''python 3.12.3''' | || Here it is '''python 3.12.3''' | ||
| − | |- | + | |- |
|| Only narration | || Only narration | ||
| Line 112: | Line 108: | ||
If your '''python version''' is''' 3.12''' or higher proceed with the following steps: If not, move to the second half of this tutorial. | If your '''python version''' is''' 3.12''' or higher proceed with the following steps: If not, move to the second half of this tutorial. | ||
| − | |- | + | |- |
|| '''>'''Type '''sudo apt install build-essential libssl-dev libffi-dev python3-dev''' | || '''>'''Type '''sudo apt install build-essential libssl-dev libffi-dev python3-dev''' | ||
|| Type the command as shown. | || Type the command as shown. | ||
| − | + | This command installs additional packages and tools. | |
| − | |- | + | |- |
|| '''>'''Type '''sudo apt install -y python3-pip''' | || '''>'''Type '''sudo apt install -y python3-pip''' | ||
| + | || Type the command as shown. | ||
| − | || | + | We install pip to manage Python packages and libraries for our projects. |
| + | |- | ||
| + | || '''>'''Type '''sudo apt install -y python3-venv''' | ||
| − | + | Then press Enter. | |
| − | + | || Type the command as shown. | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | Then press | + | |
| − | || | + | |
Virtual environments provide isolated Python project spaces on your server. | Virtual environments provide isolated Python project spaces on your server. | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''python3.12 -m venv Automation''' |
| − | + | Then press Enter. | |
| + | || Type '''python3 dot 12 space hyphen m space venv space Automation''' | ||
| − | + | You can create a new environment with the name '''Automation.''' | |
| − | + | |- | |
| − | + | ||
| − | + | ||
| − | |- | + | |
|| '''>'''Type '''source Automation/bin/activate''' | || '''>'''Type '''source Automation/bin/activate''' | ||
| − | Then press | + | Then press Enter. |
| − | || | + | || To activate the environment, type the command as shown. |
| − | + | We can see the name “Automation” in the command prompt. | |
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''sudo apt-get install espeak python3-tk default-jre''' |
| − | | | + | || Type the command as shown to install few necessary software packages for our Automation tutorial. |
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''cd Downloads''' |
| − | + | || Now, we need to '''install '''the libraries required for this python for Automation series. | |
| − | + | ||
| − | || | + | |
I have already downloaded '''packages.txt '''in my '''Downloads f'''older. | I have already downloaded '''packages.txt '''in my '''Downloads f'''older. | ||
Go to the '''Downloads '''directory by typing '''cd space Downloads.''' | Go to the '''Downloads '''directory by typing '''cd space Downloads.''' | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type'''pip3 install -r packages.txt''' |
| − | + | ||
| − | '''>'''Type'''pip3 install -r packages.txt''' | + | |
|| Now type '''pip3 space install space hyphen r space packages.txt''' | || Now type '''pip3 space install space hyphen r space packages.txt''' | ||
Through this command, we can install the necessary libraries. | Through this command, we can install the necessary libraries. | ||
| − | |- | + | |- |
|| Highlight the output | || Highlight the output | ||
| − | || We can see that all our | + | || We can see that all our libraries are installed. |
| − | |- | + | |- |
|| Only narration | || Only narration | ||
>Type deactivate | >Type deactivate | ||
|| We can exit the virtual environment with the command : '''deactivate''' | || We can exit the virtual environment with the command : '''deactivate''' | ||
| − | |- | + | |- |
| − | || | + | || Point point to the python version on the terminal. |
|| If your '''python version''' is lower than '''3.12''', we will see how to install '''python 3.12.3''' | || If your '''python version''' is lower than '''3.12''', we will see how to install '''python 3.12.3''' | ||
| − | |- | + | |- |
| − | || | + | || Point to the command. |
|| Type the command as shown | || Type the command as shown | ||
'''Hyphen y '''automatically answers''' '''"yes" to prompts in the terminal window. | '''Hyphen y '''automatically answers''' '''"yes" to prompts in the terminal window. | ||
| − | |- | + | |- |
| − | || | + | || Download python 3.12.3>'''cd /usr/src''' |
| − | + | ||
| − | Download python 3.12.3>'''cd /usr/src''' | + | |
| − | + | ||
|| Type '''“cd space forward slash usr forward slash src''' | || Type '''“cd space forward slash usr forward slash src''' | ||
This command navigates the directory to install '''Python''' from the source. | This command navigates the directory to install '''Python''' from the source. | ||
| − | |- | + | |- |
| − | || | + | || '''> sudo curl -O ''' |
| + | || Next we will type the command to install '''python3.12.3 '''as shown. | ||
| − | ''' | + | '''Hyphen capital O''' represents remote file output. |
| − | || | + | This is the URL from which '''python''' is downloaded. |
| + | |- | ||
| + | || Extract archive>'''sudo tar xzf Python-3.12.3.tgz''' | ||
| + | || To unpack the downloaded file, type the command as shown | ||
| − | + | |- | |
| − | + | || Compile and install | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | |- | + | |
| − | || | + | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | Compile and install | + | |
>'''cd Python-3.12.3''' | >'''cd Python-3.12.3''' | ||
| − | || | + | || Now we navigate to the extracted directory. |
| − | + | Type | |
| − | + | '''cd space Python hyphen 3 dot 12 dot 3''' | |
| − | + | It changes the directory to the extracted Python source. | |
| − | |- | + | |- |
|| '''>sudo ./configure --enable-optimizations''' | || '''>sudo ./configure --enable-optimizations''' | ||
| − | || | + | || Now let us configure the build and install python. |
| − | + | Type the command as shown | |
| − | + | This command prepares the build system with optimizations. | |
| − | |- | + | |- |
|| '''>sudo make -j $(nproc)''' | || '''>sudo make -j $(nproc)''' | ||
Highlight '''make -j $(nproc)''' | Highlight '''make -j $(nproc)''' | ||
| − | || | + | || Type the command as shown. |
| − | + | This command compiles the source code using all available CPU cores. | |
| − | |- | + | |- |
|| '''>sudo make altinstall''' | || '''>sudo make altinstall''' | ||
| Line 248: | Line 223: | ||
This command '''make altinstall '''install Python without overwriting the default '''Python''' binary. | This command '''make altinstall '''install Python without overwriting the default '''Python''' binary. | ||
| − | |- | + | |- |
| − | || | + | || Verify python version: '''python3.12 --version''' |
| − | + | ||
| − | Verify python version: '''python3.12 --version''' | + | |
|| Let us verify the python version that has been installed, | || Let us verify the python version that has been installed, | ||
| Line 258: | Line 231: | ||
'''python3 dot 12 space hyphen hyphen version'''. | '''python3 dot 12 space hyphen hyphen version'''. | ||
| − | |- | + | |- |
| − | || | + | || Highlight the successful installation. |
| − | + | ||
| − | Highlight the successful installation. | + | |
|| Now we can see that our '''python version 3.12.3''' is Successfully installed. | || Now we can see that our '''python version 3.12.3''' is Successfully installed. | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''cd''' |
| + | || Type '''cd''' and press '''Enter''' to reset the directory. | ||
| + | |- | ||
| + | || '''>'''Type '''sudo apt install -y python3-pip''' | ||
| − | + | Then press Enter. | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | Then press | + | |
|| Type '''sudo space apt space install space hyphen y space python3 hyphen pip''' | || Type '''sudo space apt space install space hyphen y space python3 hyphen pip''' | ||
We install pip to manage Python packages and libraries for our projects. | We install pip to manage Python packages and libraries for our projects. | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''sudo apt install -y python3-venv''' |
| − | + | Then press Enter. | |
| + | || Now let us proceed with creating a Virtual Environment. | ||
| − | + | Type the command as shown. | |
| − | + | ||
| − | + | ||
| − | + | ||
Virtual environments provide isolated Python project spaces on your server. | Virtual environments provide isolated Python project spaces on your server. | ||
| − | |- | + | |- |
|| '''>'''Type sudo '''python3.12 -m venv Automation''' | || '''>'''Type sudo '''python3.12 -m venv Automation''' | ||
|| Type '''python3 dot 12 space hyphen m space venv space Automation''' | || Type '''python3 dot 12 space hyphen m space venv space Automation''' | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''source Automation/bin/activate''' |
| − | + | Then press Enter. | |
| − | + | ||
| − | Then press | + | |
Highlight Automation | Highlight Automation | ||
| Line 306: | Line 269: | ||
We can see the name “Automation” in the command prompt. | We can see the name “Automation” in the command prompt. | ||
| − | |- | + | |- |
| − | || | + | || '''>'''Type '''sudo apt-get install espeak python3-tk default-jre''' |
| − | | | + | || Type the command as shown to install few necessary software packages for our Automation tutorial. |
| − | |- | + | |- |
| − | || | + | || '''>'''Type''' cd Downloads''' |
| + | || Now, we need to '''install '''the libraries required for this python for Automation series. | ||
| − | + | I have already downloaded '''packages.txt '''in my '''Downloads '' folder. | |
| − | + | ||
| − | + | ||
| − | + | ||
| − | I have already downloaded '''packages.txt '''in my '''Downloads | + | |
Go to the '''Downloads '''directory by typing '''cd space Downloads.''' | Go to the '''Downloads '''directory by typing '''cd space Downloads.''' | ||
| − | |- | + | |- |
| − | || | + | || '''pip3 install -r packages.txt''' |
| − | + | ||
|| Now type '''pip3 space install space hyphen r space packages.txt''' | || Now type '''pip3 space install space hyphen r space packages.txt''' | ||
Through this command, we could install the necessary libraries. | Through this command, we could install the necessary libraries. | ||
| − | |- | + | |- |
|| Highlight the output | || Highlight the output | ||
| − | || We can see that all our | + | || We can see that all our libraries are installed. |
| − | |- | + | |- |
|| Only narration | || Only narration | ||
| − | + | '''>'''Type '''deactivate''' | |
|| Once the work is done we can exit the virtual environment with the command : '''deactivate''' | || Once the work is done we can exit the virtual environment with the command : '''deactivate''' | ||
| − | |- | + | |- |
| − | || | + | || |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
|| Next let us install '''python''' on the '''Windows '''platform. | || Next let us install '''python''' on the '''Windows '''platform. | ||
| − | |- | + | |- |
|| To download in windows | || To download in windows | ||
| Line 348: | Line 302: | ||
Show browser window | Show browser window | ||
|| Open your web browser and go to the '''Python''' official website at [https://www.python.org/ python.org]. | || Open your web browser and go to the '''Python''' official website at [https://www.python.org/ python.org]. | ||
| − | |- | + | |- |
|| Hover over the '''Downloads''' section. | || Hover over the '''Downloads''' section. | ||
|| Hover over the '''Downloads''' section. | || Hover over the '''Downloads''' section. | ||
| − | |- | + | |- |
|| In the '''Downloads''', select the '''Windows''' option | || In the '''Downloads''', select the '''Windows''' option | ||
|| In the '''Downloads section''', select the '''Windows''' option | || In the '''Downloads section''', select the '''Windows''' option | ||
| − | |- | + | |- |
| − | + | || Scroll down. | |
| + | |||
| + | Scroll down.Under “[https://www.python.org/downloads/release/python-3123/ Python 3.12.3 - April 9, 2024]”''' | ||
| + | |||
| + | Click on the "'''Download [https://www.python.org/ftp/python/3.12.3/python-3.12.3-amd64.exe | ||
|| Scroll down.Under “[https://www.python.org/downloads/release/python-3123/ Python 3.12.3 - April 9, 2024]”''' | || Scroll down.Under “[https://www.python.org/downloads/release/python-3123/ Python 3.12.3 - April 9, 2024]”''' | ||
| Line 362: | Line 320: | ||
Automatically the installer is downloaded. | Automatically the installer is downloaded. | ||
| − | |- | + | |- |
| − | || Go to Downloads folder | + | || Go to '''Downloads''' folder. |
Locate and double click on '''python-3.12.3-amd64''' installer | Locate and double click on '''python-3.12.3-amd64''' installer | ||
| Line 370: | Line 328: | ||
Locate the file '''python-3.12.3-amd64''' and double click on it to run the installer. | Locate the file '''python-3.12.3-amd64''' and double click on it to run the installer. | ||
| − | |- | + | |- |
|| Click the '''Add''' '''Python.exe''' '''to''' '''PATH'''" at the bottom. | || Click the '''Add''' '''Python.exe''' '''to''' '''PATH'''" at the bottom. | ||
|| Make sure to check the box at the bottom that says "'''Add''' '''Python.exe''' '''to''' '''PATH'''" at the bottom. | || Make sure to check the box at the bottom that says "'''Add''' '''Python.exe''' '''to''' '''PATH'''" at the bottom. | ||
| − | |- | + | |- |
|| Click '''Install Now''' | || Click '''Install Now''' | ||
|| Click on "'''Install Now'''". | || Click on "'''Install Now'''". | ||
| − | |- | + | |- |
|| Complete installation | || Complete installation | ||
|| Follow the prompts until the installation is complete.This might take some time. | || Follow the prompts until the installation is complete.This might take some time. | ||
| − | |- | + | |- |
|| Click the '''close '''button. | || Click the '''close '''button. | ||
|| Then click on the Close''' '''button at the bottom right side. | || Then click on the Close''' '''button at the bottom right side. | ||
| − | |- | + | |- |
|| Show Command Prompt | || Show Command Prompt | ||
| Line 396: | Line 354: | ||
We can see the python version here. | We can see the python version here. | ||
| − | |- | + | |- |
|| Show browser window | || Show browser window | ||
'''cd Downloads''' | '''cd Downloads''' | ||
| − | || | + | || Now, we need to '''install '''the libraries required for this python for Automation series. |
I have already downloaded '''packages.txt '''in my '''Downloads '''folder. | I have already downloaded '''packages.txt '''in my '''Downloads '''folder. | ||
Go to the '''Downloads '''directory by typing '''cd space Downloads '''in the command prompt. | Go to the '''Downloads '''directory by typing '''cd space Downloads '''in the command prompt. | ||
| − | |- | + | |- |
|| Show Command Prompt | || Show Command Prompt | ||
| Line 412: | Line 370: | ||
This command installs all the libraries listed in the '''packages.txt '''file. | This command installs all the libraries listed in the '''packages.txt '''file. | ||
| − | |- | + | |- |
|| Show Command Prompt | || Show Command Prompt | ||
| Line 425: | Line 383: | ||
'''pip space list''' and press Enter. | '''pip space list''' and press Enter. | ||
| − | You should see a list of installed | + | You should see a list of installed libraries. |
| − | |- | + | |- |
|| Show slide: | || Show slide: | ||
|| This brings us to the end of the tutorial. Let us summarize. | || This brings us to the end of the tutorial. Let us summarize. | ||
| − | In this tutorial, we have learnt to | + | In this tutorial, we have learnt to, |
| − | * | + | * Install''' Python 3.12.3 '''in''' Ubuntu''' and '''Windows OS.''' |
| − | * | + | * Create a '''Virtual environment''' |
| − | * | + | * Install necessary libraries required for automation. |
| − | |- | + | |- |
| − | || | + | || Show slide: |
| − | + | ||
| − | Show slide: | + | |
'''About the Spoken Tutorial Project''' | '''About the Spoken Tutorial Project''' | ||
| − | || | + | || The video at the following link summarizes the '''Spoken Tutorial project'''. |
Please download and watch it. | Please download and watch it. | ||
|- | |- | ||
| − | | | + | || Show Slide: |
| − | + | '''Spoken Tutorial Workshops''' | |
| − | + | || The '''Spoken Tutorial Project''' team conducts workshops and gives certificates. | |
| − | + | ||
| − | | | + | |
For more details, please write to us. | For more details, please write to us. | ||
|- | |- | ||
| − | | | + | || Show Slide: |
| − | + | ||
| − | Show Slide: | + | |
'''Answers for THIS Spoken Tutorial''' | '''Answers for THIS Spoken Tutorial''' | ||
| − | | | + | || |
| − | * | + | * Do you have questions in THIS Spoken Tutorial? |
| − | * | + | * Please visit this site. |
| − | * | + | * Choose the minute and second where you have the question |
| − | * | + | * Explain your question briefly |
| − | * | + | * The Spoken Tutorial project will ensure an answer |
| + | * You will have to register to ask questions | ||
|- | |- | ||
| − | | | + | || Show Slide: |
| − | + | '''Forum for specific questions''' | |
| − | | | + | || |
| − | * | + | * The Spoken Tutorial forum is for specific questions on this tutorial. |
| − | * | + | * Please do not post unrelated and general questions on them. |
| − | * | + | * This will help reduce the clutter. |
| − | * | + | * With less clutter, we can use these discussions as instructional material. |
|- | |- | ||
| − | | | + | || show Slide: |
'''FOSSEE Forum''' | '''FOSSEE Forum''' | ||
| − | | | + | || For any general or technical questions on '''Python for''' |
'''Automation''', visit the''' FOSSEE forum''' and post your question. | '''Automation''', visit the''' FOSSEE forum''' and post your question. | ||
|- | |- | ||
| − | | | + | || Show slide |
'''Acknowledgement''' | '''Acknowledgement''' | ||
| − | | | + | || '''Spoken Tutorial''' Project was established by the '''Ministry of Education, Government of India'''. |
|- | |- | ||
| − | | | + | || Show slide |
| − | + | ||
| − | Show slide | + | |
'''Thank You''' | '''Thank You''' | ||
| − | | | + | || This is '''Dhaarani Pushpam S, '''a FOSSEE Semester long intern 2024, IIT Bombay signing off. |
| − | + | ||
Thanks for joining. | Thanks for joining. | ||
|- | |- | ||
|} | |} | ||
Revision as of 15:09, 26 December 2024
| Visual Cue | Narration |
| Show slide:
Welcome |
Welcome to the Spoken Tutorial on Setup Python environment for Automation. |
| Show slide:
Learning Objectives |
In this tutorial, we will learn how to,
|
| Show slide:
System Requirements |
To record this tutorial, I am using
|
| Show slide:
Prerequisite |
To follow this tutorial you must have basic knowledge of using
|
| Show slide:
Prerequisite |
|
| Show slide:
Code files |
|
| Show slide:
Automation |
|
| Point to the files in the downloads folder
Open Python_installation_linux.txt Open packages.txt and show |
I have created Python_installation_linux.txt and packages.txt files for installation.
Python_installation_linux.txt file has the list of commands to install python 3.12.3. You may copy and paste these commands in the terminal instead of typing. Remember to Press the Enter key after each command in the terminal. packages.txt file contains the library names used in the Python for Automation series. |
| Press Ctrl, Alt and T keys. | Now let us open the terminal window by pressing Ctrl', Alt and T keys together. |
| >Type sudo apt update
Press Enter |
Now type sudo space apt space update and press Enter.
This command refreshes the local package index with the latest repository data. |
| >Type python3 --version
Press Enter. |
Next type python3 space hyphen hyphen version.
You can see the version of python in your system. |
| Highlight Python 3.12.3 | Here it is python 3.12.3 |
| Only narration
Highlight Python 3.12.3 |
The python version varies based on the Ubuntu Linux version.
We will create a virtual environment and install the python and required libraries. If your python version is 3.12 or higher proceed with the following steps: If not, move to the second half of this tutorial. |
| >Type sudo apt install build-essential libssl-dev libffi-dev python3-dev | Type the command as shown.
This command installs additional packages and tools. |
| >Type sudo apt install -y python3-pip | Type the command as shown.
We install pip to manage Python packages and libraries for our projects. |
| >Type sudo apt install -y python3-venv
Then press Enter. |
Type the command as shown.
Virtual environments provide isolated Python project spaces on your server. |
| >Type python3.12 -m venv Automation
Then press Enter. |
Type python3 dot 12 space hyphen m space venv space Automation
You can create a new environment with the name Automation. |
| >Type source Automation/bin/activate
Then press Enter. |
To activate the environment, type the command as shown.
We can see the name “Automation” in the command prompt. |
| >Type sudo apt-get install espeak python3-tk default-jre | Type the command as shown to install few necessary software packages for our Automation tutorial. |
| >Type cd Downloads | Now, we need to install the libraries required for this python for Automation series.
I have already downloaded packages.txt in my Downloads folder. Go to the Downloads directory by typing cd space Downloads. |
| >Typepip3 install -r packages.txt | Now type pip3 space install space hyphen r space packages.txt
Through this command, we can install the necessary libraries. |
| Highlight the output | We can see that all our libraries are installed. |
| Only narration
>Type deactivate |
We can exit the virtual environment with the command : deactivate |
| Point point to the python version on the terminal. | If your python version is lower than 3.12, we will see how to install python 3.12.3 |
| Point to the command. | Type the command as shown
Hyphen y automatically answers "yes" to prompts in the terminal window. |
| Download python 3.12.3>cd /usr/src | Type “cd space forward slash usr forward slash src
This command navigates the directory to install Python from the source. |
| > sudo curl -O | Next we will type the command to install python3.12.3 as shown.
Hyphen capital O represents remote file output. This is the URL from which python is downloaded. |
| Extract archive>sudo tar xzf Python-3.12.3.tgz | To unpack the downloaded file, type the command as shown |
| Compile and install
>cd Python-3.12.3 |
Now we navigate to the extracted directory.
Type cd space Python hyphen 3 dot 12 dot 3 It changes the directory to the extracted Python source. |
| >sudo ./configure --enable-optimizations | Now let us configure the build and install python.
Type the command as shown This command prepares the build system with optimizations. |
| >sudo make -j $(nproc)
Highlight make -j $(nproc) |
Type the command as shown.
This command compiles the source code using all available CPU cores. |
| >sudo make altinstall
Highlight make altinstall |
Type sudo space make space altinstall
This command make altinstall install Python without overwriting the default Python binary. |
| Verify python version: python3.12 --version | Let us verify the python version that has been installed,
Type python3 dot 12 space hyphen hyphen version. |
| Highlight the successful installation. | Now we can see that our python version 3.12.3 is Successfully installed. |
| >Type cd | Type cd and press Enter to reset the directory. |
| >Type sudo apt install -y python3-pip
Then press Enter. |
Type sudo space apt space install space hyphen y space python3 hyphen pip
We install pip to manage Python packages and libraries for our projects. |
| >Type sudo apt install -y python3-venv
Then press Enter. |
Now let us proceed with creating a Virtual Environment.
Type the command as shown. Virtual environments provide isolated Python project spaces on your server. |
| >Type sudo python3.12 -m venv Automation | Type python3 dot 12 space hyphen m space venv space Automation |
| >Type source Automation/bin/activate
Then press Enter. Highlight Automation |
To activate the environment
Type source space Automation forward slash bin forward slash activate We can see the name “Automation” in the command prompt. |
| >Type sudo apt-get install espeak python3-tk default-jre | Type the command as shown to install few necessary software packages for our Automation tutorial. |
| >Type cd Downloads | Now, we need to install the libraries required for this python for Automation series.
I have already downloaded 'packages.txt in my Downloads folder. Go to the Downloads directory by typing cd space Downloads. |
| pip3 install -r packages.txt | Now type pip3 space install space hyphen r space packages.txt
Through this command, we could install the necessary libraries. |
| Highlight the output | We can see that all our libraries are installed. |
| Only narration
>Type deactivate |
Once the work is done we can exit the virtual environment with the command : deactivate |
| Next let us install python on the Windows platform. | |
| To download in windows
|
Open your web browser and go to the Python official website at python.org. |
| Hover over the Downloads section. | Hover over the Downloads section. |
| In the Downloads, select the Windows option | In the Downloads section, select the Windows option |
| Scroll down.
Scroll down.Under “Python 3.12.3 - April 9, 2024” Click on the "Download [https://www.python.org/ftp/python/3.12.3/python-3.12.3-amd64.exe |
Scroll down.Under “Python 3.12.3 - April 9, 2024”
Automatically the installer is downloaded. |
| Go to Downloads folder.
Locate and double click on python-3.12.3-amd64 installer |
Go to your Downloads folder.
Locate the file python-3.12.3-amd64 and double click on it to run the installer. |
| Click the Add Python.exe to PATH" at the bottom. | Make sure to check the box at the bottom that says "Add Python.exe to PATH" at the bottom. |
| Click Install Now | Click on "Install Now". |
| Complete installation | Follow the prompts until the installation is complete.This might take some time. |
| Click the close button. | Then click on the Close button at the bottom right side. |
| Show Command Prompt
Type python --version Highlight python 3.12.3 |
Open the Command Prompt by pressing the Windows key.
Type "cmd", and press Enter. Type python space hyphen hyphen version and press Enter. We can see the python version here. |
| Show browser window
cd Downloads |
Now, we need to install the libraries required for this python for Automation series.
I have already downloaded packages.txt in my Downloads folder. Go to the Downloads directory by typing cd space Downloads in the command prompt. |
| Show Command Prompt
pip install -r packages.txt |
Then, type pip space install space hyphen r space packages dot txt and press Enter.
This command installs all the libraries listed in the packages.txt file. |
| Show Command Prompt
pip list Highlight Output |
To verify that the libraries were installed successfully,
Type, pip space list and press Enter. You should see a list of installed libraries. |
| Show slide: | This brings us to the end of the tutorial. Let us summarize.
In this tutorial, we have learnt to,
|
| Show slide:
About the Spoken Tutorial Project |
The video at the following link summarizes the Spoken Tutorial project.
Please download and watch it. |
| Show Slide:
Spoken Tutorial Workshops |
The Spoken Tutorial Project team conducts workshops and gives certificates.
For more details, please write to us. |
| Show Slide:
Answers for THIS Spoken Tutorial |
|
| Show Slide:
Forum for specific questions |
|
| show Slide:
FOSSEE Forum |
For any general or technical questions on Python for
Automation, visit the FOSSEE forum and post your question. |
| Show slide
Acknowledgement |
Spoken Tutorial Project was established by the Ministry of Education, Government of India. |
| Show slide
Thank You |
This is Dhaarani Pushpam S, a FOSSEE Semester long intern 2024, IIT Bombay signing off.
Thanks for joining. |