环境
操作系统:MacOS 13.4
系统架构:osx-arm64
python版本:3.8
编辑器:PyCharm
问题
在PyCharm的terminal中安装wordcloud,但总是装不上,显示如下报错:
ERROR: Failed building wheel for wordcloud
Running setup.py clean for wordcloud
Failed to build wordcloud
ERROR: Could not build wheels for wordcloud, which is required to install pyproject.toml-based projects
经过搜索,看到这篇文章:在pycharm中使用anaconda
得知用Anaconda来安装更好。
但基于Anaconda的默认base环境(python3.10)来安装,还是失败,报错如下:
(venv) (base) jennyq@xiaoqiuqius-MBP process_proj % conda install wordcloud
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- wordcloud
用了官网搜索出的其他包安装:
conda-forge / packages / wordcloud
PyCharm终端运行代码:
conda install -c conda-forge wordcloud
也不行,报错还是和上面的相似。
【注:】但是我在安装下面的方法解决之后,重新用base的环境运行这个代码进行安装,又成功了,很奇怪。。。不知道是啥原因,,大家可以先在这里试试,如果能装上,就不用再往下看了~
解决方案
参考这篇救大命:How to fix “UnsatisfiableError: The following specifications were found to be incompatible with each other: - pip -> python=3.6”
里面有一个大佬说:
As others have said, it’s recommended to create a new, clean environment and conda install into that.
噢原来要新装一个干净的conda环境!现在的base环境已经有很多包了,而wordcloud好像是python11就不适用了,所以可能和python10也会有点乱七八糟冲突。(?)
所以咱们还是老老实实装个python 3.8的环境好了~
解决步骤如下:
1.在Anaconda中新建一个python 3.8的环境,可以自己命名:
我是在Anaconda里建的,好像也可以用代码建哈~
2.在PyCharm中调用刚刚建好的环境,可参考这篇:在pycharm中使用anaconda
3.然后安装wordcloud,方法是在PyCharm的terminal中执行以下代码:
conda install -c conda-forge wordcloud
然后就装成功啦~