-1

conda list pyyaml

# packages in environment at c:\Anaconda3:
#
# Name                    Version                   Build  Channel
pyyaml                    3.13            py36hfa6e2cd_1001    conda-forge

conda env list

# conda environments:
#
                         C:\Anaconda3
base                     c:\Anaconda3
yaml                  *  c:\Anaconda3\envs\yaml

Switching to yaml environment activiate yaml

conda list pyyaml

# packages in environment at c:\Anaconda3\envs\yaml:
#
# Name                    Version                   Build  Channel
pyyaml                    5.2              py36he774522_0

Starting Python within environment yaml with python

Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'3.13'

Why is 3.13 and not 5.2 returned?

Update 2019-12-17, 14:32

(base) D:\a\buch>
(base) D:\a\buch>conda activate yaml
(yaml) D:\a\buch>
(yaml) D:\a\buch>python
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'3.13'
>>>
(yaml) D:\a\buch>c:\Anaconda3\envs\yaml\python.exe
Python 3.6.9 |Anaconda, Inc.| (default, Jul 30 2019, 14:00:49) [MSC v.1915 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import yaml
>>> yaml.__version__
'3.13'
>>> 
vbd
  • 3,437
  • 4
  • 32
  • 45

1 Answers1

0

That is because in anaconda by default you will be in the base environment where the version of pyyaml is 3.13(in your case).

If you activate the environment yaml and check the version of pyyaml, you will find the 5.2 version of pyyaml

The problem in your case is that you are in the same base environment. Kindly use the following command to switch to the other environment.

conda activate yaml

You forgot to use the conda command before activate yaml hence you are in the same base environment.

Kindly follow this link also. Hope this will help you.

Saurav Rai
  • 2,171
  • 1
  • 15
  • 29