Conda is a popular open source package management system and environment management system that simplifies package installation and updates for Python libraries like scikit-learn.
This example shows how to easily upgrade scikit-learn to the latest version using Conda. The upgrade process works on Windows, macOS, and Linux platforms where Anaconda or Miniconda is installed.
To upgrade scikit-learn using Conda, run the following command in your terminal or Anaconda Prompt:
conda update -c conda-forge scikit-learn
To confirm that scikit-learn was successfully upgraded, you can import it in a Python script or interactive shell and print out the version number:
import sklearn
print(sklearn.__version__)
Running the example gives an output like:
1.5.0
The
conda updatecommand upgradesscikit-learnto the latest version available in theconda-forgechannel. The-cflag specifies the channel to use for the update.The Python script imports the installed
sklearnlibrary and prints its version number usingsklearn.__version__to verify the update occurred successfully.