我如何告诉 Sphinx 使用 Anaconda 解释器

How do I tell Sphinx to Use the Anaconda Interpreter

我创建了一个 Python 项目,它使用 Anaconda 作为 python 解释器。该项目 运行 很好,但现在我正尝试使用 Sphinx 对其进行记录,但我 运行 遇到了一个找不到 Crypto 库的问题。有没有办法告诉 Sphinx 使用 Anaconda Python 解释器?或者列出依赖项以便可以找到它们的方法?

这是我在 运行 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.

这是我的 make 文件:

@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

所以原来我需要从Path变量中删除所有对Python27的引用,删除PYTHONHOME环境变量,然后使用命令make html SPHINXBUILD=C:\Anaconda2\Lib\site-packages\Sphinx-1.5.4-py2.7.egg\sphinx