How To Uninstall All Pip Packages
Python modules are packages, or modules, which can be imported into a project to use. This includes packages similar matplotlib, numpy, flask, and many more than. To install and uninstall packages for Python y'all need to use Pip; PIP is a package manager for Python packages, or modules.
Python modules that are stored on your home drive, will just exist attainable by you lot. Other students, kinesthesia, and staff that require the same packages will have to individually run the following commands as well for shared Python projects.
Fully managed RHEL7 Linux systems currently support Python 2.seven, Python iii.4, and Python 3.vi, these can be launched via their corresponding commands: "python, python3.four, and python3.6".
Determining which version of Pip to use
Make up one's mind which version of Python y'all would like to install the package for, for each version of python in that location is a corresponding pip director.
Python Version | Python Command | Pip Command |
---|---|---|
Python 2.7 | python | pip |
Python 3.iv | python3.4 | pip3.4 |
Python 3.six | python3.6 | pip3.6 |
In all of the following examples below supplant the variable '$PIP' with the respective pip command.
Note: The control python3 and pip3 currently map to python3.half-dozen and pip3.6, respectively.
Installing Python packages using Pip
In this example, flask will be installed and uninstalled. Flask is a package used for front end-end Python spider web-development.
- Open a terminal.
- To install a package employ the control '$PIP install --user <package-name>' where $PIP is the Pip Version command in the to a higher place table.
- This case will install the flask package.
- In this instance using Python 2.7: 'pip install --user flask'
- For Python 3.6 this would be 'pip3.vi install --user flask'
- This will import the flask package and its dependencies if it has any.
- This case will install the flask package.
Uninstalling/removing Python packages using Pip
- Open a last window.
- To uninstall, or remove, a package employ the control '$PIP uninstall <package-name>'.
- This example will remove the flask package.
- In this example using Python 2.seven: 'pip uninstall - flask'
- For Python 3.half-dozen this would exist 'pip3.6 uninstall --user flask'
- Annotation: Y'all will be unable to remove packages installed directly on the organisation
- This example will remove the flask package.
- The command volition ask for confirmation after listing the files to exist removed. Confirm this action by typing 'y' and so Enter cardinal.
Upgrading a Python package using Pip
If you wish to update a Python module you lot can practise so with the '--upgrade' flag
- Open a final.
- To upgrade a package use the command '$PIP install --upgrade --user <package-name>'
- This instance will upgrade the numpy package:
- In this instance using Python 2.7: 'pip install --upgrade --user numpy'
- For Python 3.half dozen this would be 'pip3.6 install --upgrade --user numpy'
- NOTE: You will be unable to upgrade packages installed locally on the arrangement
- This instance will upgrade the numpy package:
Location of installed Python packages through Pip
By default Python packages installed through pip using the '--user' flag volition be stored in one of the following locations in your home directory, depending on which version of python you lot installed the package for:
Annotation: ~ is your dwelling directory location, as well equivalent to $HOME .
~/.local/lib/python2.seven/site-packages
~/.local/lib/python3.four/site-packages
~/.local/lib/python3.half-dozen/site-packages
By default, Python packages installed locally on each system volition be stored in one of the following directories, depending on which version of python packages you are looking for:
/usr/lib/python2.7/site-packages
/usr/lib/python3.4/site-packages
/usr/lib/python3.vi/site-packages
Cleanly managing python modules
When working on many unlike python programs you may run into issues regarding conflicts between modules that yous accept installed. Ane pick python offers to manage this is the usage of Virtual Environments which contain everything needed to run the program inside of your virtual surround directory.
Python 2.vii does not incorporate virtual environments by default, however, there is a module to handle this called Virtualenv.
Python 3.4 and 3.6 accept this feature born, as seen from here from the official Python documentation. The Virtualenv module is also available for Python iii.four and Python three.six.
Source: https://servicedesk.mtu.edu/TDClient/1801/Portal/KB/ArticleDet?ID=66715
0 Response to "How To Uninstall All Pip Packages"
Post a Comment