麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > Python > 正文

詳解pyenv下使用python matplotlib模塊的問題解決

2020-02-15 23:50:59
字體:
來源:轉載
供稿:網友

先來描述一下我遇到的問題,在進行matplotlib學習時, plot.show() 總是無法成功運行,總是會報一個錯:

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. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

其實意思很簡單,就是我用的python并不是一個作為系統框架存在的,因為我為了方便管理python的版本,選擇了 pyenv 這個管理工具,是一個獨立出來的python環境。

嘗試解決無果

參考網上眾多的解決方法,例如以下兩個最常見的:

方法一: 添加如下兩行 代碼解決:

>>> import matplotlib>>> matplotlib.use('TkAgg')##在import matplotlib下的模塊,如pyplot等之前添加上面2句>>> import matplotlib.pyplot as plt

方法二: 添加一下matplotlib的配置:

echo "backend: TkAgg" >> ~/.matplotlib/matplotlibrc

然而,以上這兩種解決方式都***無法解決我的問題***,此時出現了第二個錯誤:

No module named '_tkinter'

說是找不到 tkinter 這個模塊,找了網上大多數方法,全都是linux系統下的解決方案,我真的很好奇沒有一個使用mac的用戶出現我這樣的問題嗎? 究其原因,是因為,使用 pyenv 獨立安裝出來的python中并沒有 tkinter 這個模塊,于是嘗試直接安裝 tkinter ,結果竟然提示沒有發現 tkinter 包!

pip3 install tkinterCollecting tkinterCould not find a version that satisfies the requirement tkinter (from versions: )No matching distribution found for tkinter

來到這,我不禁陷入了深深的思考,這個 tkinter 到底是何方神圣,去了Python社區:https://docs.python.org/3/library/tkinter.html ,這才懂了他是啥玩意:

The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. Both Tk and  tkinter are available on most Unix platforms, as well as on Windows systems. (Tk itself is not part of Python; it is maintained at ActiveState.) Running  python -m tkinter from the command line should open a window demonstrating a simple Tk interface, letting you know that  tkinter is properly installed on your system, and also showing what version of Tcl/Tk is installed, so you can read the Tcl/Tk documentation specific to that version.

說白了, tkinter 就是一個利用python做GUI(圖形用戶界面),它提供各種標準的 GUI 接口項,以利于迅速進行高級應用程序開發。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成人爽a毛片免费啪啪红桃视频 | 国产一区二区三区四区五区在线 | 91精品最新国内在线播放 | 九九热视频免费观看 | 毛片视频免费播放 | 免费黄色在线 | 亚洲视频精选 | 色七七亚洲 | 成人毛片在线 | 色中色在线播放 | 国产亚洲精品久久久久久久久久 | 中文字幕综合 | 一区二区三区日韩 | 日韩大片在线永久观看视频网站免费 | 高清av免费 | 毛片一区二区三区四区 | 97精品视频在线观看 | 精品无吗乱吗av国产爱色 | 欧美日韩国产一区二区三区在线观看 | 日本免费中文字幕 | 欧美精品欧美极品欧美激情 | 久久久久久久91 | 免费a级观看 | 黄色一级片在线观看 | 香蕉久草视频 | 精品一区二区免费视频视频 | 久草在线视频网 | 九九热视频这里只有精品 | 精品91av| 久久99精品视频在线观看 | 亚洲精品久久久久久久久久 | 午夜国内精品a一区二区桃色 | 欧美成在人线a免费 | 久久久成人精品视频 | 国产精品视频一区二区三区四区五区 | 日本一区二区久久 | 国产毛片毛片毛片 | 国产91在线免费 | 日本一区二区不卡在线观看 | 欧美成人福利 | 免费观看9x视频网站在线观看 |