That said, many people don't actually inspect the code and just run it. For this reason, the official instructions recommend downloading the script and inspecting it before running. It's worth noting that running any python script blindly is inherently dangerous. This line gets the official "get-pip.py" script as per the installation notes and executes the script with the "exec" command.įor Python2 you would replace "urllib.request" with "urllib2": python -c "import urllib2 exec(urllib2.urlopen('').read())" Here is the single line program that can be run via the command line using Python 3: python -c "import urllib.request exec(('').read())"
The official docs recommend using curl to download the get-pip script, but since I work on windows and don't have curl installed I prefer using python itself to download and run the script. If you want to upgrade or downgrade your version of pip to a specific version on a Mac, you can do this by adding a pipIf everything went well you could see the above success message.The best way I have found is to write a single line program that downloads and runs the official get-pip script. python3-m pip install-upgrade requests Windows. For example, to install the latest version of requests and all of its dependencies: Unix/macOS. C:\Users\user\AppData\Local\Programs\Python\Python37\Scripts>pip install -upgrade pipĭownloading 圓-none-any.whl (1.5 MB) Upgrading packages¶ pip can upgrade packages in-place using the -upgrade flag. Go to the same pip installation directory and hit the below command.
Pip install –upgrade pip command is used to upgrade the pip.
pipupgrade -check Checks and pretty prints outdated packages (Does not perform upgrades). You can use the pip freeze command to generate a requirements file that includes all of the current packages and their versions, and then use pip install -r. Pip 20.0.2 from c:\users\user\appdata\local\programs\python\python37\lib\site-packages\pip (python 3.7)Ĭurrently, I am on PIP 20.0.0, let’s upgrade PIP with the latest version. Upgrades all the packages within the defined pip environment. Open the windows command prompt and go to PIP installations directory.įor me it is : C:\Users\\AppData\Local\Programs\Python\Python37\Scripts Check for the pip version pip -version