Python:没有名为sphinx的模块错误 [英] Python: No module named sphinx error

查看:785
本文介绍了Python:没有名为sphinx的模块错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遵循了指南.

$ pip install sphinx sphinx-autobuild
$ pip freeze | grep "sphinx"
sphinx-autobuild==0.6.0
sphinxcontrib-websupport==1.0.0

$ cd docs
$ sphinx-quickstart
$ make html

make html给出以下错误:

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named sphinx
make: *** [help] Error 1

[Q] 如何防止此错误发生?

[Q] How could I prevent this error from happening?

感谢您的宝贵时间和帮助.

Thank you for your valuable time and help.

推荐答案

首先,不要在系统的Python中安装任何内容.使用虚拟环境或系统的用户安装将软件包与系统Python隔离. Python打包机构提供了为什么虚拟环境是一个好主意的解释.

First, don't install anything into your system's Python. Use either a virtual environment or your system's user installs to isolate packages from the system Python. The Python Packaging Authority provides an explanation of why virtual environments are a good idea™.

我更喜欢先在系统上安装另一个版本的Python,方法是使用官方macOS的安装程序(初学者)或 pyenv (不是初学者).除非绝对必须使用Python 2,否则请安装Python 3.x.

I prefer to start by installing another version of Python on my system, either using the official installers for macOS (beginner) or pyenv (not beginner). Install Python 3.x unless you absolutely must use Python 2.

下一步安装或升级Python的打包工具.这是我在Python中安装或升级软件包的极少数情况之一,尽管您可能想为用户这样做.

Next install or upgrade your Python's packaging tools. This is one of the very rare times that I install or upgrade packages in my Pythons, although you may want to do so for your user.

下一步创建并使用虚拟环境.

最后,按照将Sphinx安装到正确的指南您的虚拟环境并开始使用Sphinx.

Finally follow the correct guide to install Sphinx into your virtual environment and get started using Sphinx.

这篇关于Python:没有名为sphinx的模块错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆