简体   繁体   English

如何解决 python 人性化错误:ImportError cannot import name on_windows from 'humanfriendly.compat'

[英]How to resolve python humanfriendly error: ImportError cannot import name on_windows from 'humanfriendly.compat'

I'm on windows 10 and using python 3.7.3我在 windows 10 并使用 python 3.7.3

If I open an ipython terminal and type:如果我打开一个 ipython 终端并输入:

import humanfriendly

I get the following error:我收到以下错误:

        In [7]: import humanfriendly
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-7-69d5bc3698c4> in <module>
----> 1 import humanfriendly

~\Anaconda3\lib\site-packages\humanfriendly\__init__.py in <module>
     23 # support for other tables has been added and the name of format_table() has
     24 # changed. The following import statement preserves backwards compatibility.
---> 25 from humanfriendly.tables import format_pretty_table as format_table
     26
     27 # In humanfriendly 1.30 the following text manipulation functions were moved

~\Anaconda3\lib\site-packages\humanfriendly\tables.py in <module>
     30 # Modules included in our package.
     31 from humanfriendly.compat import coerce_string
---> 32 from humanfriendly.terminal import (
     33     ansi_strip,
     34     ansi_width,

~\Anaconda3\lib\site-packages\humanfriendly\terminal\__init__.py in <module>
     43
     44 # Modules included in our package.
---> 45 from humanfriendly.compat import coerce_string, is_unicode, on_windows, which
     46 from humanfriendly.decorators import cached
     47 from humanfriendly.deprecation import define_aliases

ImportError: cannot import name 'on_windows' from 'humanfriendly.compat' (C:\Users\Me\Anaconda3\lib\site-packages\humanfriendly\compat.py)

I cannot find anything specifically related to this error msg on google or StackOverflow.我在 google 或 StackOverflow 上找不到与此错误消息特别相关的任何内容。

How do I resolve this error?如何解决此错误?

Eventually traced the issue to the Anaconda version of humanfriendly which does not include the 'on_windows' function.最终将问题追溯到人性化的 Anaconda 版本,其中不包括“on_windows”function。 The conda-forge version does. conda-forge 版本可以。

I used我用了

conda remove humanfriendly

then然后

conda install --channel "conda-forge" humanfriendly

Problem solved.问题解决了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 怎样才能在Azure ML中导入某些python库? - How can certain python libraries be imported in azure ML?Like the line import humanfriendly gives error 导入错误:导入错误:无法从“bson.py3compat”导入名称“abc” - Import Error : ImportError: cannot import name 'abc' from 'bson.py3compat' Statsmodel ImportError 中的 Python 3.9:无法从“statsmodels.compat.python”导入名称“Literal” - Python 3.9 in Statsmodel ImportError: cannot import name 'Literal' from 'statsmodels.compat.python' ElasticSearch ImportError:无法从“elasticsearch.compat”导入名称“映射” - ElasticSearch ImportError: cannot import name 'Mapping' from 'elasticsearch.compat' ImportError:无法从“bson.py3compat”导入名称“abc” - ImportError: cannot import name 'abc' from 'bson.py3compat' 如何解决 ImportError: cannot import name 'DesicionTreeClassifier' from 'sklearn.tree' in python? - How to resolve the ImportError: cannot import name 'DesicionTreeClassifier' from 'sklearn.tree' in python? python,Windows 7:ImportError:无法导入名称X - python, windows 7: ImportError: cannot import name X 未能导入pandas-datareader,“ ImportError:无法从&#39;pandas.compat&#39;导入名称&#39;StringIO&#39;” - Failing to import pandas-datareader, “ImportError: cannot import name 'StringIO' from 'pandas.compat'” NLTK 中的导入错误:无法导入名称兼容 - Import Error in NLTK: Cannot import name compat ImportError:无法从“tensorflow.compat.v2.experimental”导入 Keras 导入名称“dtensor” - ImportError: cannot import name 'dtensor' from 'tensorflow.compat.v2.experimental' import Keras
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM