第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

matplotlib Python的安裝問題

matplotlib Python的安裝問題

哆啦的時光機 2019-08-23 14:17:34
matplotlib Python的安裝問題我在安裝matplotlib軟件包后無法將matplotlib.pyplot作為plt導入。任何建議都將非常感激。>>> import matplotlib.pyplot as pltTraceback (most recent call last):   File "<stdin>", line 1, in <module>   File "//anaconda/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/pyplot.py", line 98, in <module>     _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()   File "//anaconda/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/__init__.py", line 28, in pylab_setup     globals(),locals(),[backend_name],0)   File "//anaconda/lib/python2.7/site-packages/matplotlib-1.3.1-py2.7-macosx-10.5-x86_64.egg/matplotlib/backends/backend_macosx.py", line 21, in <module>     from matplotlib.backends import _macosx**RuntimeError**: Python is not installed as a framework. The Mac OS 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 backends.
查看完整描述

3 回答

?
不負相思意

TA貢獻1777條經(jīng)驗 獲得超10個贊

問題原因 在mac os圖像渲染中,matplotlib的后端(默認情況下使用Cocoa的API渲染的后端是什么)。有Qt4Agg和GTKAgg,作為后端不是默認值。設置macosx的后端與其他windows或linux os相比有所不同。

我通過以下方式解決此問題:

  • 我假設你已經(jīng)安裝了pip matplotlib,你的root中有一個目錄叫做~/.matplotlib。

  • ~/.matplotlib/matplotlibrc那里創(chuàng)建一個文件并添加以下代碼:backend: TkAgg

從這個鏈接你可以嘗試不同的圖表。


查看完整回答
反對 回復 2019-08-23
  • 3 回答
  • 0 關(guān)注
  • 639 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號