Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python yaml: ModuleNotFoundError

I created a new environment in conda and installed there yaml.

$ conda list | grep yaml
yaml                      0.1.7                had09818_2

but I cannot import it:

$ python -c 'import yaml'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'yaml'

Python points to the right directory with the env:

$ which python
/home/xxx/.conda/envs/tf2/bin/python

What can be the issue?

I checked similar questions: in this the problem was caused by bad disk sector, while in this the single answer does not really explain anything.

My python is 3.7.4 on Ubuntu 16.04 if it matters.

like image 237
hans Avatar asked Mar 03 '23 11:03

hans


1 Answers

The Conda package, yaml, is the C library for parsing YAML. The Python library goes by the name pyyaml. So,

conda install pyyaml
like image 62
merv Avatar answered Mar 12 '23 22:03

merv