scikit-learn can be easily uninstalled using pip, the standard package installer for Python.
This uninstallation procedure will work on Windows, macOS, and Linux where pip is installed.
To uninstall scikit-learn, simply run the following command in your terminal:
pip uninstall scikit-learn
To confirm that scikit-learn was successfully uninstalled, you can try to import it in a Python script or interactive shell:
import sklearn
print(sklearn.__version__)
Running the example should give an error like:
ModuleNotFoundError: No module named 'sklearn'
The first code block shows the
pip
command to uninstall scikit-learn.The second code block attempts to import the
sklearn
library and print its version number usingsklearn.__version__
.The
ModuleNotFoundError
confirms that scikit-learn is no longer installed and available in your Python environment.