在 Windows Ubuntu 更新 Bash 中的 Python 库

Update Python library in Bash on Ubuntu on Windows

不久前,我创建了一个虚拟环境来使用 Python tensorflow 库 Bash Ubuntu Windows。

在该环境中使用 pip3 list 时,我可以看到安装了 1.1.0 版的 tensorflow。与此同时,tensorflow 1.5已经发布。

我正在尝试使用 pip3 install tensorflow 将 tensorflow 库更新到新版本。但我只收到消息 "Requirement already satisfied"。

如何在此环境中将 tensorflow(以及我的其他库,发生同样的事情)上传到最新版本?

来自 this question 我使用以下 python 脚本:

import pip
import subprocess
for dist in pip.get_installed_distributions():
    if 'site-packages' in dist.location:
        try:
            subprocess.call(['pip3', 'install', '-U', dist.key])
            print("updated " + dist.key)
        except Exception as exc:
            print(exc)

用 python3 调用它,它应该升级所有需要更新的包。您可能还想查看其他替代方案。