【问题标题】:How to create some environments for tensorflow in anaconda?如何在 anaconda 中为 tensorflow 创建一些环境?
【发布时间】:2020-01-15 04:36:00
【问题描述】:

这里是python的新手,我需要几个用于anaconda的TensorFlow环境(一个是tf,另一个是旧版本)。

人们通常如何做这样的事情?

编辑:遇到一个障碍。删除环境时遇到问题。找到了fix 这个的方法。得到:

    PackagesNotFoundError: The following packages are missing from the target environment:

  -

现在尝试@B200011011 建议:conda create -n myenv python=3.7 ... got 3.8.1

但我无法安装 tensorflow:

...>pip install tensorflow
ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none)
ERROR: No matching distribution found for tensorflow

编辑结束。

编辑 2:

今天有效:

(base) D:\ray\dev\ml\DC to Edge Course>conda update conda
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

编辑 2 结束。

以下是我尝试过的。

我有:

(base) ...>conda env list

  conda environments:

base                     D:\Anaconda3
                      *  d:\Anaconda3

为什么我有两个?

尝试:conda update --all 获取:

The following packages will be DOWNGRADED:

  anaconda                                   2019.10-py37_0 --> custom-py37_1
  pycosat                              0.6.3-py37hfa6e2cd_0 --> 0.6.3-py37he774522_0

当我执行以下操作时会发生同样的事情:conda update anaconda

我应该继续吗?

当我尝试更新 python 时,我得到:

Updating python is constricted by

anaconda -> requires python==3.7.4=h5263a28_0

If you are sure you want an update of your package either try `conda update --all` or install a specific version of the package you want using `conda install <pkg>=<version>`

done

# All requested packages already installed.

我应该继续吗?

当我创建一个新环境时,它里面没有 python。

如果我尝试克隆基地,我会得到:

The following packages cannot be cloned out of the root environment:
 - defaults/win-64::conda-4.8.1-py37_0
 - defaults/win-64::conda-build-3.18.9-py37_3
 - defaults/win-64::conda-env-2.6.0-1

这是做什么的?对tensoflow有影响吗?

【问题讨论】:

  • 我建议使用 pyenv 和 pyenv-virtualenv 来管理不同的 python 环境
  • 一个好的起点是使用 conda,如下所述:docs.anaconda.com/anaconda/user-guide/tasks/tensorflow 用于在流行的 IDE 中使用 (ana)conda,例如PyCharm,可以访问此页面:jetbrains.com/help/pycharm/… 我确信,其他主要 IDE 也存在类似的支持页面。
  • 你是通过什么方式安装你的python版本和anaconda的?因为 Windows 上同时存在用户模式和系统模式,这可能会产生干扰。要找出答案,您可以在 cmd 中键入以下命令:where anacondawhere python。这应该会输出安装中找到的位置列表。如果缺少某些内容,您还可以查看PATH 以查看添加到那里的天气。

标签: python-3.x windows tensorflow anaconda


【解决方案1】:

我在 conda 环境中遇到过类似的没有 python 的问题。此链接包含创建和管理 conda 环境的必要信息, https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

命令conda create -n myenv python=3.7 将使用python 3.7 创建一个名为myenv 的新环境。同样可以使用conda remove --name myenv --all命令删除。

conda env list 命令将显示已创建环境的列表,包括基础环境。 conda activate myenv 将激活环境,现在在终端 tensorflow 中可以使用 pip 安装,pip install --upgrade tensorflow

这里还提供了使用 conda 环境设置 tensorflow 的说明, https://www.tensorflow.org/install/pip

GPU 指令在这里, https://www.tensorflow.org/install/gpu

在 pycharm 中,从现有 conda 环境中选择 python 解释器将使其所有包可用。

【讨论】:

【解决方案2】:

你的错误,

我们更喜欢使用conda install &lt;package&gt; 而不是pip install &lt;package&gt;

【讨论】:

猜你喜欢
  • 2021-10-14
  • 2020-12-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-28
  • 2018-03-21
  • 2018-01-19
  • 1970-01-01
  • 2018-06-20
相关资源
最近更新 更多