Python is available on a wide variety of platforms including Linux and Mac OS X. Let’s understand how to set up our Python environment.
Open a terminal window and type “python” to find out if it is already installed and which version is installed.
You can download Python from https://www.python.org/downloads/.
After download specified version and specified operating system python installer, install python.
Once you’ve successfully run the Python installer, you should see the following icons appear in your start menu, on your home screen:
Add the Python 3.10 Directory to your System Path Environment Variable
In order to make it so you can access Python via any command line prompt (and not just the Python-specific one), you’ll need to add the newly-installed Python 3.10 directory to your “Path” system environment variable. This makes it easier to access Python and run scripts in whatever shell you’re using to using (Command Prompt, PowerShell, and Git Bash.)
So, go to Control Panel –> System Properties –> Environment Variables and select the PATH variable from the list below:
With that in place, you can now start the Python interpreter on any command prompt by invoking the python command. Let’s get our package manager set up for Python.
Install pip to Manage Your Python Packages
Step-1 Download PIP get-pip.py
Before installing PIP, download the – get-pip.py file for 3.x and get-pip.py file for 2.7
- Launch a command prompt if it isn’t already open. To do so, open the Windows search bar, type cmd and click on the icon.
- Then, run the following command to download the get-pip.py file:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
Step-2 Installing PIP on Windows
To install PIP type in the following:
Upgrading PIP for Python on Windows
To upgrade PIP on Windows, enter the following in the command prompt:
python -m pip install --upgrade pip
This command uninstalls the old version of PIP and then installs the most current version of PIP.
Downgrade PIP Version
Downgrading may be necessary if a new version of PIP starts performing undesirably. To downgrade PIP to a prior version, specifying the version you want.
To downgrade PIP, use the syntax:
python -m pip install pip==version_number
For example, to downgrade to version 18.1, you would run:
python -m pip install pip==18.1
You should now see the version of PIP that you specified.
Thanks for reading see you in next topic.