安装tens的正确命令

2024-04-25 20:18:46 发布

您现在位置:Python中文网/ 问答频道 /正文

当尝试在水蟒上安装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',))",),)

原因是什么?在


Tags: installtoorgnonejsonhttpurlgpu
2条回答

张量流有两种类型:

  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 

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

^{pr2}$

对于一些可能不知道-c channel选项的人,为conda添加一个channel来搜索包。在

请尝试以下操作:

anaconda logout
conda update conda

而不是重新安装

另外,请查看官方的web-site以查看使用Anaconda安装TensorFlow的细节

相关问题 更多 >