2017-06-02 3 views
0

私はディレクトリ内の私のソースコードを持っている - は、/ usr/share/jupiter_api/jupiter_api /サービス/ V1Pythonの:スフィンクスインポートエラー:いいえモジュール

スフィンクスファイル -

  1. を/ usr/share /木星-DOC/index.rst - > /usr/share/jupiter-doc/api/jupiter_api.rst

jupiter_api.rstファイルは、オートドキュメントを生成

  • jupiter_api.rst呼び出します。

    .. automodule:: accounts 
        :members: 
    

    /usr/share/jupiter-doc/api/conf.py

    sys.path.append(os.path.abspath('/jupiter_api/jupiter_api/servicesi/v1/')) 
    

    私はきれいにし、make htmlを実行したときに、私は以下のエラーメッセージが表示されます -

    Removing everything under '_build'... 
    
    [ /usr/share/jupiter-doc/api ] 
    [email protected] > make html 
    Running Sphinx v1.6.2 
    making output directory... 
    /usr/lib/python2.7/site-packages/sphinx/util/requests.py:72: UserWarning: 
    Some links may return broken results due to being unable to check the Server 
    Name Indication (SNI) in the returned SSL cert against the hostname in the 
    url requested. Recommended to install requests-2.4.1+. 
    'Some links may return broken results due to being unable to ' 
    loading pickled environment... not yet created 
    building [mo]: targets for 0 po files that are out of date 
    building [html]: targets for 1 source files that are out of date 
    updating environment: 1 added, 0 changed, 0 removed 
    reading sources... [100%] jupiter_api 
    WARNING: /usr/share/jupiter-doc/api/jupiter_api.rst:15: (WARNING/2) autodoc: 
    failed to import module u'accounts'; the following exception was raised: 
    Traceback (most recent call last): 
    File "/usr/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 657, in 
    import_object 
        __import__(self.modname) 
    ImportError: No module named accounts 
    looking for now-outdated files... none found 
    pickling environment... done 
    checking consistency... done 
    preparing documents... done 
    writing output... [100%] jupiter_api 
    generating indices... genindex 
    writing additional pages... search 
    copying static files... done 
    copying extra files... done 
    dumping search index in English (code: en) ... done 
    dumping object inventory... done 
    build succeeded, 1 warning. 
    
    Build finished. The HTML pages are in _build/html. 
    
  • 答えて

    0

    おそらく必要です

    sys.path.insert(0, os.path.abspath('../jupiter_api/jupiter_api/services/v1/')) 
    

    あなたのconf.pyのprint(sys.path)でこれをebugしてください。

    ああ、conf.pyはjupiter_doc/api/ですが、index.rstは1レベル高いです。しかし、あなたはconf.pyのレベルであなたのMakefileを持っています。そして、あなたはもう一つ'../'が必要です。しかし、あなたのconf.pyのmaster_docjupiter_apiだと思いますか?なぜあなたの文書でindex.rstconf.pyが同じトップレベルにあるのですか?

    関連する問題