How to create some environments for tensorflow in anaconda?

瘦欲@ 提交于 2020-01-16 12:00:02

问题


Fairly new to python here, I need a couple of TensorFlow environments for anaconda (one is tf, while the other is an older version).

How do people usually do stuff like this?

Edit: got by one obstacle. Was having problems removing environments. Found way to fix this. Was getting:

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

  -

Now going to try @B200011011 suggestion: conda create -n myenv python=3.7 ... got 3.8.1

but I can not install 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

End of Edit.

Below is what I have tried.

I have:

(base) ...>conda env list

  conda environments:

base                     D:\Anaconda3
                      *  d:\Anaconda3

Why do I have two?

Trying: conda update --all gets:

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

Same thing happens when i do a: conda update anaconda

Should i proceed?

When i try to update python, i get:

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.

Should I proceed?

When I create a new environment, it has no python in it.

if i try to clone the base, I get:

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

What did this do? Will it have any effect on tensoflow?


回答1:


I faced similar problem of no python in conda environment. This link contains necessary information to create and manage conda environment, https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

The command, conda create -n myenv python=3.7 will create a new environment named myenv with python 3.7. It can be similarly deleted by using command, conda remove --name myenv --all.

conda env list command will show list of created environments including base. conda activate myenv will activate the environment and now here in terminal tensorflow can be installed with pip using, pip install --upgrade tensorflow.

Instructions for setting up tensorflow with conda environment also available here, https://www.tensorflow.org/install/pip

GPU instructions here, https://www.tensorflow.org/install/gpu

In pycharm selecting python interpreter from an existing conda environment will make all its package available.




回答2:


With your error,

We prefer to use conda install <package> instead of pip install <package>



来源:https://stackoverflow.com/questions/59745202/how-to-create-some-environments-for-tensorflow-in-anaconda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!