2017-05-03 15 views
0

AnacondaをPythonインタプリタとして使用するPythonプロジェクトを作成しました。プロジェクトはうまく動作しますが、今はSphinxを使ってそれを文書化しようとしていますが、私はCryptoライブラリが見つからないという問題に遭遇しています。 SphinxにAnaconda Pythonインタプリタを使用するよう指示する方法はありますか?依存関係をすべて見つけられるようにリストする方法?ここでSphinxにAnacondaインタプリタを使用するように指示する方法

は私がmake htmlコマンドを実行したときに私が取得エラーです:ここでは

Running Sphinx v1.5.5 
making output directory... 
loading pickled environment... not yet created 
building [mo]: targets for 0 po files that are out of date 
building [html]: targets for 6 source files that are out of date 
updating environment: 6 added, 0 changed, 0 removed 
reading sources... [100%] modules 

C:\Users\MyUser\MyProject\docs\source\http.rst:19: WARNING: autodoc: failed to import module u'h 
ttp.security_mgr'; the following exception was raised: 
Traceback (most recent call last): 
    File "C:\Python27\lib\site-packages\sphinx\ext\autodoc.py", line 551, in import_object 
    __import__(self.modname) 
    File "C:\Users\MyUser\MyProject\http\security_mgr.py", line 29, in <module> 
    from Crypto.Cipher import AES 
ImportError: No module named Crypto.Cipher 
looking for now-outdated files... none found 
pickling environment... done 
checking consistency... done 
preparing documents... done 
writing output... [100%] modules 
generating indices... genindex py-modindex 
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 warnings. 

Build finished. The HTML pages are in build\html. 

は私のメイクファイルです:

@ECHO OFF 

pushd %~dp0 

REM Command file for Sphinx documentation 

if "%SPHINXBUILD%" == "" (
    set SPHINXBUILD=sphinx-build 
) 
set SOURCEDIR=source 
set BUILDDIR=build 
set SPHINXPROJ=PythonSDK 

if "%1" == "" goto help 

%SPHINXBUILD% >NUL 2>NUL 
if errorlevel 9009 (
    echo. 
    echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 
    echo.installed, then set the SPHINXBUILD environment variable to point 
    echo.to the full path of the 'sphinx-build' executable. Alternatively you 
    echo.may add the Sphinx directory to PATH. 
    echo. 
    echo.If you don't have Sphinx installed, grab it from 
    echo.http://sphinx-doc.org/ 
    exit /b 1 
) 

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 
goto end 

:help 
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 

:end 
popd 
+0

私はAnacondaの仮想環境とパッケージングの処理に慣れていません。私のプロジェクトのパッケージとSphinxをすべてインストールするPython仮想環境では、仮想環境を有効にせず、 'make html SPHINXBUILD =/path/to/virtual_environment/bin/sphinx-build'を使ってSphinxを起動し、 。おそらくアナコンダには類似したものがありますか? –

+0

@StevePiercy正しい場所を指しているかどうかわかりません。エラーのパスのAnacondaバージョンを見つけ、 'make html SPHINXBUILD = C:\ Anaconda2 \ Lib \ site-packages \ Sphinx-1.5.4-py2.7.egg \ sphinx'コマンドと' make html SPHINXBUILD = C:\ Anaconda2 \ Lib \ site-packages \ Sphinx-1.5.4-py2.7.egg \ sphinx \ ext'ですが、Anacondaの代わりにPython27を使用しているというエラーが表示されます。あなたのsphinx-buildフォルダにはautodoc.pyのようなスクリプトが含まれていますか? – jencoston

答えて

0

だから、私からPython27へのすべての参照を除去するために必要判明しますPath変数を削除し、PYTHONHOME環境変数を削除してから、コマンドを使用してください。make html SPHINXBUILD=C:\Anaconda2\Lib\site-packages\Sphinx-1.5.4-py2.7.egg\sphinx

関連する問題