python - 为什么我无法在 spyder (v 3.3.4) 中加载 wordcloud?
问题描述
无论我做什么,我都不能在 Anaconda 中使用 wordcloud - spyder
import wordcloud
Traceback (most recent call last):
File "<ipython-input-104-dc1828f2a80e>", line 1, in <module>
import wordcloud
ModuleNotFoundError: No module named 'wordcloud'
经过一番研究,我意识到我需要通过 shell 程序安装包。所以我使用 pip 命令安装了 wordcloud
C:\Users\1025990\AppData\Local\Programs\Python\Python37-32\Scripts>pip install wordcloud
Collecting wordcloud
Using cached https://files.pythonhosted.org/packages/d4/95/d260ce89441d1f28192fa5a0a016f547829517b11cabe0079ab91c56f6cd/wordcloud-1.5.0.tar.gz
Requirement already satisfied: numpy>=1.6.1 in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (1.16.4)
Requirement already satisfied: pillow in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (6.0.0)
Building wheels for collected packages: wordcloud
Building wheel for wordcloud (setup.py) ... done
Stored in directory: C:\Users\1025990\AppData\Local\pip\Cache\wheels\0a\24\57\899dc50402fef8c355561bcfadfe36879def229e6d97424281
Successfully built wordcloud
Installing collected packages: wordcloud
WARNING: The script wordcloud_cli.exe is installed in 'c:\users\1025990\appdata\local\programs\python\python37-32\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed wordcloud-1.5.0
我知道警告与安装无关,因为更改环境变量会消除它。我已经做到了(但没有在这里发布)
之后我再次执行了shell命令
C:\Users\1025990\AppData\Local\Programs\Python\Python37-32\Scripts>pip install wordcloud
Requirement already satisfied: wordcloud in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (1.5.0)
Requirement already satisfied: numpy>=1.6.1 in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (1.16.4)
Requirement already satisfied: pillow in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (from wordcloud) (6.0.0)
我也更新了 shell 中的设置工具
C:\Users\1025990\AppData\Local\Programs\Python\Python37-32\Scripts>pip install -U setuptools
Requirement already up-to-date: setuptools in c:\users\1025990\appdata\local\programs\python\python37-32\lib\site-packages (41.0.1)
现在我检查是否可以在 spyder 中使用 wordcloud,所以我再次运行命令
from wordcloud import WordCloud
Traceback (most recent call last):
File "<ipython-input-105-021e0a03a31f>", line 1, in <module>
from wordcloud import WordCloud
ModuleNotFoundError: No module named 'wordcloud'
我不明白我错过了什么。请帮忙!
解决方案
您是否有可能有多个 python 实例并将其安装到另一个而不是您实际使用的实例上?这是此类问题的常见原因。
通过在您的 python 控制台中获取您的实际版本,import sys
print(sys.executable)
并为您的模块检查此路径的站点包文件夹。
推荐阅读
- swift - MIME 类型的所有应用程序 URL
- amazon-web-services - AWS Codepipe 网络钩子
- c - 无法在“.vscode”文件夹中创建“launch.json”文件(无法读取未定义的属性“长度”)
- ruby-on-rails - 如何对具有相同类型的数组中相同键的值求和?
- vue.js - 为什么 Vue 剥离了这一组件中的样式属性
- c - 如何使用输入字母在屏幕上打印姓名以该字母开头的员工列表及其对应信息
- cmake - 安装后找不到 Clang-Tidy
- python - 是否可以使用 Python 将规则的联系人导入 Outlook 中的文件夹?
- c++ - 如何使用相应的 X509 证书验证私有 RSA 签名签名
- python - 期待预期的字符串或类似字节的对象