簡體   English   中英

Python 在 Mac OS X 上通過 Conda:RuntimeError: Python 未作為框架安裝

[英]Python via Conda on Mac OS X: RuntimeError: Python is not installed as a framework

我在 Mac 10.14.6 上運行,到目前為止我嘗試過的所有解決方案都沒有奏效。 我正在關注OpenAI spinup的文檔並被困在這條線上:

python -m spinup.run plot data/installtest/installtest_s0

在嘗試導入 matplotlib 和 plot 一些圖表時,我不斷得到:

文件 /anaconda3/envs/spinningup2/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py",第 14 行,來自 matplotlib.backends import _macosx ImportError: ZA7F5F35426B927411FC9231B563817 未安裝為框架。 X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other后端。如果您使用的是 (Ana)Conda,請安裝 python.app 並將“python”的使用替換為“pythonw”。有關更多信息,請參閱 Z1587383CF8C21507D06FB51EF7 中的“在 OSX 上使用 Matplotlib”。

在網上搜索后,我發現這是一個很常見的問題,所以這是我迄今為止嘗試過的:


1. https://github.com/scikit-optimize/scikit-optimize/issues/637

添加

import matplotlib
matplotlib.use('PS')

在導入matplotlib.pyplot之前

我仍然有同樣的錯誤。


2. https://markhneedham.com/blog/2018/05/04/python-runtime-error-osx-matplotlib-not-installed-as-framework-mac/

而不是from matplotlib import pyplot as plt我使用了:

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

但是我仍然遇到同樣的錯誤。


3. matplotlib: RuntimeError: Python 沒有作為框架安裝

添加一行:

backend: TkAgg

在文件中:

~/.matplotlib/matplotlibrc

這不能解決我的問題,我有同樣的錯誤


4.

我嘗試在 ~/.matplotlib/matplotlibrc 創建一個文件並使用以下文本填充它:

$ cat ~/.matplotlib/matplotlibrc
backend: TkAgg

使用cat命令時,這會以某種方式使我的 MAC 崩潰並導致重新啟動。 我很困擾。


任何幫助或建議將不勝感激。 我已經嘗試了我在這個網站上找到的所有建議,但沒有運氣。

我能夠通過卸載 matplotlib 來解決這個問題,然后使用 Conda 重新安裝我需要的確切版本(可能是 3.0.3)。

我還注意到,Conda 安裝了六個 (six-1.15.0-py37hecd8cb5_0) 作為其中的一部分,所以不確定罪魁禍首是什么,但現在已修復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM