[英]ModuleNotFoundError: No module named 'unidecode' yet I have the module installed
I am trying to remove accents from a Python list of strings by converting it from UTF-8 to ASCII.我试图通过将 Python 字符串列表从 UTF-8 转换为 ASCII 来从字符串列表中删除重音符号。 I have read answers to multiple questions here in StackOverflow that suggest using the unidecode function from the unidecode package.
我在 StackOverflow 中阅读了多个问题的答案,这些问题建议使用 unidecode 包中的 unidecode 函数。 I have installed it using conda but if I write
我已经使用 conda 安装了它,但是如果我写
import unidecode
I get我得到
ModuleNotFoundError: No module named 'unidecode'
I have tried excluding unidecode and reinstalling it (using both conda and pip) and I checking if the PATH
was pointing to all Anaconda locations, as advised in Alexander McFarlane's answer to this question .我已经尝试排除 unidecode 并重新安装它(同时使用 conda 和 pip),并且我检查了
PATH
是否指向所有 Anaconda 位置,如Alexander McFarlane 对此问题的回答中所述。
I had the same problem, capitalizing Unidecode in the pip command worked for me.我遇到了同样的问题,在 pip 命令中大写 Unidecode 对我有用。
pip install Unidecode
https://pypi.org/project/Unidecode/ https://pypi.org/project/Unidecode/
follow steps按照步骤
1.open cmd 1.打开cmd
2.give full path to the script folder eg 2.给出脚本文件夹的完整路径,例如
C:\\Python37-32\\Scripts
C:\\Python37-32\\Scripts
3.then try pip commands 3.然后尝试pip命令
pip install Unidecode pip 安装 Unidecode
C:\\Python37-32\\Scripts>pip install unicode
C:\\Python37-32\\Scripts>pip install unicode
done!完毕!
Make sure you are using the same version of Python when you install the package and when you run it.确保在安装包和运行包时使用相同版本的 Python。 You are probably installing the library in one version and running using a different version.
您可能在一个版本中安装库并使用不同版本运行。
You can check the python version in terminal this way:您可以通过以下方式在终端中检查 python 版本:
python3 --version
Also try to create and work on an environment, install your packages in the environment then try to run.还尝试创建并在环境中工作,在环境中安装您的软件包,然后尝试运行。
Read more about package managment in Conda since you use it https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html阅读有关 Conda 中的包管理的更多信息,因为您使用它https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.