Python 如何 pip 安装旧版本的库(tensorflow)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41937915/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 01:54:28  来源:igfitidea点击:

How to pip install old version of library(tensorflow)?

pythonmacostensorflowpip

提问by Himmators

I'm trying to install tensorflow r0.11. I tried

我正在尝试安装 tensorflow r0.11。我试过

pip install tensorflow==r0.11
pip install tensorflow<0.12

But I get this error

但我收到这个错误

Could not find a version that satisfies the requirement tensorflow==0.11.0 (from versions: 0.12.0rc0, 0.12.0rc1, 0.12.0, 0.12.1)
No matching distribution found for tensorflow==0.11.0

I assume pip is no longer support depricated versions, how can I get it?

我认为 pip 不再支持已弃用的版本,我怎样才能得到它?

I also tried

我也试过

pip install git+git://github.com/tensorflow/[email protected]

Cloning git://github.com/tensorflow/tensorflow (to r0.11) to /private/var/folders/1p/7km73m0s2cvdfb1js3ct8_mh0000gn/T/pip-JMMIRP-build
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/private/var/folders/1p/7km73m0s2cvdfb1js3ct8_mh0000gn/T/pip-JMMIRP-build/setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/1p/7km73m0s2cvdfb1js3ct8_mh0000gn/T/pip-JMMIRP-build/

采纳答案by ash

You can install the pip wheel from a URL directly, for example:

您可以直接从 URL 安装 pip wheel,例如:

# Ubuntu/Linux 64-bit, CPU only, Python 2.7
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.11.0-cp27-none-linux_x86_64.whl
pip install --ignore-installed --upgrade $TF_BINARY_URL

In general, installation instructions for older versions of TensorFlow can be found at : For binaries for installation using wheels: Go to tensorflow pypi release history, select the release of your choice, say tensorflow 1.8.0, go to Download filesand either download the wheel file and then install or copy the download link and save in TF_BINARY_URLfor your python --versionand os[mac, linux or windows]install as shown above

一般来说,可以在以下位置找到旧版本 TensorFlow 的安装说明:对于使用轮子安装的二进制文件:转到tensorflow pypi 发布历史,选择选择的版本,例如tensorflow 1.8.0,转到下载文件,然后下载轮子文件,然后安装或复制下载链接并保存TF_BINARY_URL为您python --versionos [mac, linux or windows]安装,如上所示

回答by Zhao

This works for me on Mac OS 10.13.1.

这在 Mac OS 10.13.1 上对我有用。

pip install --user install tensorflow==1.3.0. 

回答by Rene B.

If you want to install tensorflow r0.11, it means that you want to install the sources from a certain branch(r0.11). Therefore, you should follow the official installation instructions from tensorflow: https://www.tensorflow.org/install/install_sources:

如果要安装 tensorflow r0.11,则意味着要安装来自某个分支r0.11)的源代码。因此,您应该遵循 tensorflow 的官方安装说明:https://www.tensorflow.org/install/install_sources

In case you want to install a "normal" release. then you can easily use the following command:

如果您想安装“正常”版本。那么您可以轻松使用以下命令:

pip install --upgrade tensorflow==1.3.0.

回答by flow2k

This worked for me:

这对我有用:

pip3 install 'tensorflow==1.2.0' --force-reinstall

pip3 install 'tensorflow==1.2.0' --force-reinstall

回答by zolty13

If you have your own library/packet on github/gitlab etc, you have to add tag to commit with concrete version of library e.g. v2.0 then you can install your packet

如果您在 github/gitlab 等上有自己的库/数据包,则必须添加标签以使用具体版本的库(例如 v2.0)提交,然后您可以安装您的数据包

pip install git+ssh://link/name/[email protected]