工程问题 | pip upgrade problem

背景:在使用Github项目的时候,往往会遇到某个Python package对于版本的要求跟当前机器上的版本不符。通常的做法是通过pip install --upgrade XXX的方式来更新package就能够解决版本问题,但某些情况下会出现一些无法卸载旧版本从而更新新版本的情况出现。


问题

$ pip install --upgrade XXX
Error: Cannot uninstall 'scikit-learn'. It is a distutils installed project and thus we 
cannot accurately determine which files belong to it which would lead to only 
a partial uninstall.

解决方案

1. Reduced version,
    pip install --upgrade --force-reinstall pip==9.0.3
2. Tried to re-install package
    pip install xxx --disable-pip-version-check
3. At last, recover the latest version for pip
    pip install --upgrade pip

你可能感兴趣的:(工程问题 | pip upgrade problem)