ReadTheDocs上Sphinx构建失败:-T选项不被识别求助
Troubleshooting "option -T not recognized" in ReadTheDocs Sphinx Build
Hey there! Let's figure out why you're hitting this -T option error even though ReadTheDocs is using Sphinx 1.6.5 (which definitely supports -T—it's been around since 1.2). Here are the most likely fixes to try:
1. Check Your ReadTheDocs Build Command Settings
Head over to your project's ReadTheDocs dashboard, go to Admin > Advanced Settings, and look at the Build Command field:
- If you've manually set a custom command, double-check for typos. For example, make sure it looks like this (adjust paths if needed):
sphinx-build -T -b html docs/ _build/html - If you're not sure, try clearing the custom command and letting ReadTheDocs use its default build logic—it automatically handles the correct parameters for the Sphinx version it's using.
2. Audit Your docs/conf.py Configuration
Take a look at your Sphinx config file:
- Are there any lines modifying
sys.argvor overriding build parameters? For example, code that adds/removes flags could accidentally break the-Toption in the RTD environment. - Double-check for version-specific conditionals that might be incorrectly disabling flags for Sphinx 1.6.5.
3. Verify Your Project's Dependencies
If you're using a requirements.txt or pyproject.toml to specify dependencies:
- Make sure you haven't pinned Sphinx to a version older than 1.2. For example, a line like
sphinx==1.1.3would force RTD to install an outdated version that doesn't recognize-T. - Update your dependency spec to something like
sphinx>=1.6.5to match RTD's environment, or remove the pin entirely to let RTD use its default version.
4. Test Locally to Isolate the Issue
Install Sphinx 1.6.5 on your local machine and run the same build command RTD uses:
sphinx-build -T -b html docs/ _build/html
- If this fails locally, the problem is in your project's configuration (not RTD). Debug your conf.py or build setup.
- If it works locally, try triggering a fresh build on RTD (sometimes cached environments cause issues) or clearing RTD's build cache via the project settings.
Example Error Context
error: option -T not recognized
内容的提问来源于stack exchange,提问作者Dylan Klomparens
相关产品推荐
相关产品推荐

