2017-08-03 21 views
2

https://readthedocs.org/にドキュメントを作成しようとしています。readthedocsのSphinx autodoc:ImportError:_tkinterという名前のモジュールがありません

matplotlibをインポートするファイルのdocstringは表示されません。

私は、ビルドログに見ると、私はメッセージで、from matplotlib import pyplot as pltが失敗したことを参照してください。

/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/checkouts/latest/docs/source/plotting.rst:67: WARNING: autodoc: failed to import function u'dbplot' from module u'artemis.plotting.db_plotting'; the following exception was raised: 
Traceback (most recent call last): 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 551, in import_object 
    __import__(self.modname) 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/artemis_ml-1.6-py2.7.egg/artemis/plotting/db_plotting.py", line 3, in <module> 
    from artemis.plotting.matplotlib_backend import BarPlot 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/artemis_ml-1.6-py2.7.egg/artemis/plotting/matplotlib_backend.py", line 7, in <module> 
    from matplotlib import pyplot as plt 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module> 
    _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup() 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup 
    globals(),locals(),[backend_name],0) 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module> 
    from six.moves import tkinter as Tk 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/six.py", line 203, in load_module 
    mod = mod._resolve() 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/six.py", line 115, in _resolve 
    return _import_module(self.mod) 
    File "/home/docs/checkouts/readthedocs.org/user_builds/artemis-ml/envs/latest/lib/python2.7/site-packages/six.py", line 82, in _import_module 
    __import__(name) 
    File "/home/docs/.pyenv/versions/2.7.13/lib/python2.7/lib-tk/Tkinter.py", line 39, in <module> 
    import _tkinter # If this fails your Python may not be configured for Tk 
ImportError: No module named _tkinter 

私はすでに(readthedocsで[管理]> [詳細設定])を指定したページのように:

  • プロジェクトはvirtualenvでビルドする必要があります
  • プロジェクトは、matplotlibを含むrequirements.txtファイルを使用してビルドする必要があります。上記のメッセージからインストールされていることも確認できます。正しく表示されていません。

誰もがこれまでに遭遇し、それを修正する方法を知っていますか?

Tkinter: "Python may not be configured for Tk"での回答は、読書に関することではありません。

答えて

1

MERoseのソリューションは、おそらく最高のですが、場合、それはここで働いていないで私のために働いていた別の回避策は次のとおりです。

あなただけ<project root>/docs/source/conf.pyを開き、行を挿入することにより、Tkinterのを必要としない「AGG」バックエンド、とスフィンクス使用インポートmatplotlibのを行うことができます。

import matplotlib 
matplotlib.use('agg') 

最後に

関連する問題