[英]Cannot update sklearn on Jupyter notebook
I am on a Sagemaker Jupyter notebook and I need to use version 0.22 or above to train and pickle my model. However, I cannot update the version of sklearn.我在 Sagemaker Jupyter notebook 上,我需要使用 0.22 或更高版本来训练和 pickle 我的 model。但是,我无法更新 sklearn 的版本。
!pip3 install sklearn --upgrade
Output: Output:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Requirement already up-to-date: sklearn in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (0.0)
Requirement already satisfied, skipping upgrade: scikit-learn in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from sklearn) (0.22.1)
Requirement already satisfied, skipping upgrade: numpy>=1.11.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from scikit-learn->sklearn) (1.18.1)
Requirement already satisfied, skipping upgrade: joblib>=0.11 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from scikit-learn->sklearn) (0.15.1)
Requirement already satisfied, skipping upgrade: scipy>=0.17.0 in /home/ec2-user/anaconda3/envs/python3/lib/python3.6/site-packages (from scikit-learn->sklearn) (1.4.1)
import sklearn
print('The scikit-learn version is {}.'.format(sklearn.__version__))
# The scikit-learn version is 0.20.3. <---- still 0.20
!conda update scikit-learn -y
or或者
!conda update -n base scikit-learn -y
Output: Output:
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.5.12
latest version: 4.8.3
Please update conda by running
$ conda update -n base -c defaults conda
# All requested packages already installed.
import sklearn
print('The scikit-learn version is {}.'.format(sklearn.__version__))
# The scikit-learn version is 0.20.3. <---- still 0.20
I have also run conda update -n base -c defaults conda
or conda update all
but still getting the same version.我也运行了
conda update -n base -c defaults conda
或conda update all
但仍然得到相同的版本。
From the error message it seems the following should work:从错误消息看来,以下应该有效:
python3 -m pip3 install --upgrade sklearn
pip install sklearn --upgrade
or或者
pip install sklearn -U
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.