Python yaml:ModuleNotFoundError [英] Python yaml: ModuleNotFoundError

查看:59
本文介绍了Python yaml:ModuleNotFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 conda 中创建了一个新环境并安装了 yaml.

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

$ conda list | grep yaml
yaml                      0.1.7                had09818_2

但我无法导入它:

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

Python 使用 env 指向正确的目录:

Python points to the right directory with the env:

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

可能是什么问题?

我查了类似的问题:在这个问题是由坏的磁盘扇区引起的,而在这个单一的答案并不能真正解释任何事情.

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.

如果重要的话,我的 python 在 Ubuntu 16.04 上是 3.7.4.

My python is 3.7.4 on Ubuntu 16.04 if it matters.

推荐答案

Conda 包,yaml,是用于解析 YAML 的 C 库.Python 库 的名称为 pyyaml.所以,

conda install pyyaml

这篇关于Python yaml:ModuleNotFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆