gpt4 book ai didi

python - 安装tensorflow的正确命令

转载 作者:太空宇宙 更新时间:2023-11-04 00:32:06 24 4
gpt4 key购买 nike

尝试在 Anaconda 上安装 Tensorflow 时,我尝试了两种类型的命令。 conda install tensorflow-gpu 工作正常。但是,当尝试 conda install -c anaconda tensorflow-gpu 时,如图所示 here .它给出以下错误消息。

Fetching package metadata ...
CondaHTTPError: HTTP None None for url <https://conda.anaconda.org/anaconda/linux-64/repodata.json>
Elapsed: None

An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
ConnectionError(MaxRetryError("HTTPSConnectionPool(host='conda.anaconda.org', port=443): Max retries exceeded with url: /anaconda/linux-64/repodata.json (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x2b8e3f4ec110>: Failed to establish a new connection: [Errno -2] Name or service not known',))",),)

可能是什么原因?

最佳答案

有两种类型的 tensorflow :

  1. 仅支持 CPU 的 TensorFlow
  2. 支持 GPU 的 TensorFlow

您必须选择安装 TensorFlow 的机制。支持的选项如下:

  1. virtualenv

  2. using pip

  3. Docker

  4. Anaconda

我用pip给出步骤

安装,在终端中运行以下命令

sudo apt-get install python-pip python-dev   # for Python 2.7
sudo apt-get install python3-pip python3-dev # for Python 3.n

pip install tensorflow # Python 2.7; for CPU support
pip3 install tensorflow # Python 3.n; for CPU support
pip install tensorflow-gpu # Python 2.7; for GPU support
pip3 install tensorflow-gpu # Python 3.n; for GPU support

卸载,请在终端中运行以下命令:

sudo pip uninstall tensorflow  # for Python 2.7
sudo pip3 uninstall tensorflow # for Python 3.n

关于python - 安装tensorflow的正确命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45428427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com