从python模块卸载并重新安装pip包

Ram*_*mar 8 python pip

我使用以下pip函数从python中卸载了包'setuptools'

import pip
pip.main(['uninstall','--yes','setuptools'])
Run Code Online (Sandbox Code Playgroud)

当我尝试使用下面的命令再次重新安装相同的包时,它会抛出以下错误消息

pip.main(['install','setuptools'])
Run Code Online (Sandbox Code Playgroud)

错误:

Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\\python27\\lib\\site-packages
Run Code Online (Sandbox Code Playgroud)

有没有办法克服这个问题?提前致谢 :)

min*_*ret 7

是的,--ignore-installed.有关更多信息:pip install --help解释:

-U, --upgrade               Upgrade all specified packages to the newest
                            available version. This process is recursive
                            regardless of whether a dependency is already
                            satisfied.
--force-reinstall           When upgrading, reinstall all packages even if
                            they are already up-to-date.
-I, --ignore-installed      Ignore the installed packages (reinstalling
                            instead).
Run Code Online (Sandbox Code Playgroud)

此外,我尝试使用Python 3.4.在上述选项中,只会pip install --ignore-installed安装以前安装的软件包.