如何在Anaconda中使用Python的框架构建 [英] How to use a framework build of Python with Anaconda
问题描述
我无法在Mac计算机上显示matplotlib动画.我已经尝试了几次安装ffmpeg的尝试,但都失败了,我开始怀疑这是否不是解决问题的错误方法.
I'm unable to get matplotlib animations to display on a Mac computer. I've chased down several attempts at installing ffmpeg but they've all failed and I'm starting to wonder if that isn't the wrong way to solve the problem.
我找到了此页面.
由于我是从Anaconda的Spyder应用程序运行Python,因此本节似乎很相关.它说
Since I'm running Python from the Spyder app in Anaconda, the section for this seems relevant. It says
(Ana)Conda中提供的默认python不是框架版本. 但是,Conda开发人员使安装框架变得容易 在主要环境和Conda环境中构建.要使用这个 安装python.app
conda install python.app
并使用pythonw
比python
The default python provided in (Ana)Conda is not a framework build. However, the Conda developers have made it easy to install a framework build in both the main environment and in Conda envs. To use this install python.app
conda install python.app
and usepythonw
rather thanpython
我不清楚这是什么意思,但是我打开了一个终端,运行conda install python.app
,它似乎可以正常工作-至少没有错误消息.我可以导航到包含文件python.app
的文件夹.
I'm not perfectly clear on what this means, but I opened a terminal, ran conda install python.app
and it seemed to work--at least there were no error messages. I could navigate to a folder that contained the file python.app
.
我不清楚使用pythonw
"是什么意思,但是我导航到要编译和运行$ pythonw anim.py
的动画,这给了我I/O错误.我不确定是否应该以其他方式使用pythonw
或其他方式.如果我重新启动并尝试在Spyder中运行代码,则会收到与以前相同的错误.
I'm not clear on what it means to "use pythonw
" but I navigated to the animation I'm trying to compile and ran $ pythonw anim.py
and it gave me an I/O error. I'm not sure if I'm supposed to use pythonw
in some other way, or what. If I restart and try to run the code in Spyder I get the same error as before.
我知道代码可以工作,因为我已经在具有ffmpeg并且可以正常工作的Linux机器上运行了它.
I know that the code works, because I've run it on a Linux machine that has ffmpeg and it worked.
还有什么需要做的事情来构建框架,这意味着什么?
Is there something else I need to do to get a framework build, whatever that means?
推荐答案
安装框架构建后,您必须将python解释器的位置从python更改为pythonw.我不熟悉Spyder,但是在VS代码中,我通过
After installing the framework build, you have to change the location of your python interpreter from python to pythonw. I am not familiar with Spyder, but in VS code I solved this issue modifying the settings.json file from
{
"python.pythonPath": "/Users/[username]/miniconda3/envs/base-evn/bin/python"
}
到
{
"python.pythonPath": "/Users/[username]/miniconda3/envs/base-evn/bin/pythonw"
}
我正在使用minicoda.对于anaconda,您的主目录中的文件夹可能被命名为以下其中之一:
I am using minicoda. For anaconda, the folder in your home directory might be named one of the following:
anaconda2. anaconda3.
anaconda2. anaconda3.
这篇关于如何在Anaconda中使用Python的框架构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!