I want to build html docs using a virtualenv instead of the native environment on my machine.
I've entered the virtualenv but when I run make html
I get errors saying the module can't be imported - I know the errors are due to the module being unavailable in my native environment. How can I specify which environment should be used when searching for docs (eg the virtualenv)?
$ sphinx-build -b html sourcedir builddir where sourcedir is the source directory, and builddir is the directory in which you want to place the built documentation. The -b option selects a builder; in this example Sphinx will build HTML files. Refer to the sphinx-build man page for all options that sphinx-build supports.
The sphinx-build refers following environment variables: A path to make command. A command name is also allowed. sphinx-build uses it to invoke sub-build process on make-mode. The Makefile and make.bat files created by sphinx-quickstart usually run sphinx-build only with the -b and -d options.
In this tutorial you will build a simple documentation project using Sphinx, and view it in your browser as HTML. The project will include narrative, handwritten documentation, as well as autogenerated API documentation. The tutorial is aimed towards Sphinx newcomers willing to learn the fundamentals of how projects are created and structured.
This script will generate the skeleton of the sphinx project. Create a python task in Run/Edit-Configurations... in PyCharm like below. Be careful with the python interpreter and your script (If you use python environment like me). This script will generate the rst files for your modules.
The problem is correctly spotted by Mathijs.
$ which sphinx-build /usr/local/bin/sphinx-build
I solved this issue installing sphinx itself in the virtual environment.
With the environment activated:
$ source /home/migonzalvar/envs/myenvironment/bin/activate $ pip install sphinx $ which sphinx-build /home/migonzalvar/envs/myenvironment/bin/sphinx-build
It seems neat enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With