有关windows 64位下sphinx的配置,记录下来,以备自查

来源:互联网 发布:cdkey软件 编辑:程序博客网 时间:2024/06/10 06:00

从网上下载下来一个开源框架,发现文档目录里,都是.rst格式的文档格式,网上搜索发现有关.rst格式的内容很少,里面有关程序的更少,发现这格式与sphinx有关。sphinx是python的一个工具模块,安装sphinx步骤如下:

1.为了在命令行下,直接运行python命令,实现在命令行下,不用进入 Python 目录即可执行 python.exe,先进行配置环境变量,放在path里面,即“path = C:\Python33;C:\Python33\Scripts”。C:\Python33是我电脑里路径,根据实际电脑路径为准! 

2.安装setuptools 7.0,从https://pypi.python.org/pypi/setuptools#downloads中发现下载ez_setup.py ,然后命令行下运行此文件,或者如果电脑里只有一个python版本的话,直接双击也可运行,推荐第二种,注意:第二方法是python3系列版本才有的!关于ez_setup.py,网上这么说的:

ez_setup.py这是 setuptools 自豪的一种安装方式,只需要一个大约 8K 作为的脚本ez_setup.py,就能自动为用户安装包括 setuptools 自身在内的许多 Python 包。使用这种方式,用户只需要下载 ez_setup.py 并运行,就可以自动下载和安装适合用户当前 Python 版本的适当的 setuptools egg 文件(当然,用户需要 Python 2.3.5 以上的版本,64 位操作系统的用户则需要 Python 2.4 以上的版本)。此外,这段脚本还会将可执行的 easy_install 脚本安装到用户所有的操作系统 Python 可执行脚本正常应该安装的位置(例如,Windows 用户会安装到 Python 安装目录下的 Scripts 目录中)。关于这种安装方法的更详细说明和注意事项,请参考其官方说明。!

安装成功后,会在C:\Python33\Scripts中发现多了一项easy_install-3.3-script.py的文件。

题外话:再记录下用pip安装时,出现的问题,命令行里敲击pip install -U setuptools,然后提示

Requirement already up-to-date: setuptools in c:\python33\lib\site-packages\setuptools-7.0-py3.3.egg
Cleaning up... 

不知道这是种啥情况,有知道的网友请说下

有关PIP的安装,请参考 https://pip.pypa.io/en/latest/installing.html ,关于PIP是干啥的,我也不清楚,不影响sphinx配置,暂且不管它,嘿嘿

3、使用方法

使用方法非常简单,在命令行输入“easy_install 参数”即可。具体为在控制台下命令行输入easy_install sphinx,操作第一次时,命令行里提示:

Searching for sphinx
Reading https://pypi.python.org/simple/sphinx/
Best match: Sphinx 1.3b1
Downloading https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.3b1.tar.gz#md5=c9be45edbec48f4e4e7cfc53831c2225
error: None 貌似没有成功,继续第二次,须等待个几分钟,根据网络情况而定,命令行里会出现以下内容

C:\Users\Administrator>easy_install sphinxSearching for sphinxReading https://pypi.python.org/simple/sphinx/Best match: Sphinx 1.3b1Downloading https://pypi.python.org/packages/source/S/Sphinx/Sphinx-1.3b1.tar.gz#md5=c9be45edbec48f4e4e7cfc53831c2225Processing Sphinx-1.3b1.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-unma0f\Sphinx-1.3b1\setup.cfgRunning Sphinx-1.3b1\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-unma0f\Sphinx-1.3b1\egg-dist-tmp-404kpyno previously-included directories found matching 'doc\_build'Adding sphinx 1.3b1 to easy-install.pth fileInstalling sphinx-autogen-script.py script to C:\Python33\ScriptsInstalling sphinx-autogen.exe script to C:\Python33\ScriptsInstalling sphinx-build-script.py script to C:\Python33\ScriptsInstalling sphinx-build.exe script to C:\Python33\ScriptsInstalling sphinx-quickstart-script.py script to C:\Python33\ScriptsInstalling sphinx-quickstart.exe script to C:\Python33\ScriptsInstalling sphinx-apidoc-script.py script to C:\Python33\ScriptsInstalling sphinx-apidoc.exe script to C:\Python33\ScriptsInstalled c:\python33\lib\site-packages\sphinx-1.3b1-py3.3.eggProcessing dependencies for sphinxSearching for coloramaReading https://pypi.python.org/simple/colorama/Best match: colorama 0.3.2Downloading https://pypi.python.org/packages/source/c/colorama/colorama-0.3.2.zip#md5=179cc70c4a61901ffd052576b598f11eProcessing colorama-0.3.2.zipWriting c:\users\admini~1\appdata\local\temp\easy_install-z4n3_0\colorama-0.3.2\setup.cfgRunning colorama-0.3.2\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-z4n3_0\colorama-0.3.2\egg-dist-tmp-7kbdg6zip_safe flag not set; analyzing archive contents...Adding colorama 0.3.2 to easy-install.pth fileInstalled c:\python33\lib\site-packages\colorama-0.3.2-py3.3.eggSearching for babelReading https://pypi.python.org/simple/babel/Best match: Babel 1.3Downloading https://pypi.python.org/packages/source/B/Babel/Babel-1.3.tar.gz#md5=5264ceb02717843cbc9ffce8e6e06bdbProcessing Babel-1.3.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-klijrk\Babel-1.3\setup.cfgRunning Babel-1.3\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-klijrk\Babel-1.3\egg-dist-tmp-kj56l_warning: no previously-included files matching '*' found under directory 'docs\_build'warning: no previously-included files matching '*.pyc' found under directory 'tests'warning: no previously-included files matching '*.pyo' found under directory 'tests'Adding babel 1.3 to easy-install.pth fileInstalling pybabel-script.py script to C:\Python33\ScriptsInstalling pybabel.exe script to C:\Python33\ScriptsInstalled c:\python33\lib\site-packages\babel-1.3-py3.3.eggSearching for snowballstemmer>=1.1Reading https://pypi.python.org/simple/snowballstemmer/Best match: snowballstemmer 1.2.0Downloading https://pypi.python.org/packages/source/s/snowballstemmer/snowballstemmer-1.2.0.tar.gz#md5=51f2ef829db8129dd0f2354f0b209970Processing snowballstemmer-1.2.0.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-wknfvl\snowballstemmer-1.2.0\setup.cfgRunning snowballstemmer-1.2.0\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-wknfvl\snowballstemmer-1.2.0\egg-dist-tmp-l6236bwarning: no files found matching '*.py' under directory 'src'zip_safe flag not set; analyzing archive contents...Adding snowballstemmer 1.2.0 to easy-install.pth fileInstalled c:\python33\lib\site-packages\snowballstemmer-1.2.0-py3.3.eggSearching for docutils>=0.10Reading https://pypi.python.org/simple/docutils/Best match: docutils 0.12Downloading https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz#md5=4622263b62c5c771c03502afa3157768Processing docutils-0.12.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-c_enqx\docutils-0.12\setup.cfgRunning docutils-0.12\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-c_enqx\docutils-0.12\egg-dist-tmp-yuxuf6warning: no files found matching 'MANIFEST'warning: no files found matching '*' under directory 'extras'warning: no previously-included files matching '.cvsignore' found under directory '*'warning: no previously-included files matching '*.pyc' found under directory '*'warning: no previously-included files matching '*~' found under directory '*'warning: no previously-included files matching '.DS_Store' found under directory '*'copy/convert test suitezip_safe flag not set; analyzing archive contents...docutils.parsers.rst.directives.__pycache__.misc.cpython-33: module references __file__docutils.writers.html4css1.__pycache__.__init__.cpython-33: module references __file__docutils.writers.latex2e.__pycache__.__init__.cpython-33: module references __file__docutils.writers.odf_odt.__pycache__.__init__.cpython-33: module references __file__docutils.writers.pep_html.__pycache__.__init__.cpython-33: module references __file__docutils.writers.s5_html.__pycache__.__init__.cpython-33: module references __file__docutils.writers.__pycache__.docutils_xml.cpython-33: module references __path__Adding docutils 0.12 to easy-install.pth fileInstalling rst2html.py script to C:\Python33\ScriptsInstalling rst2latex.py script to C:\Python33\ScriptsInstalling rst2man.py script to C:\Python33\ScriptsInstalling rst2odt.py script to C:\Python33\ScriptsInstalling rst2odt_prepstyles.py script to C:\Python33\ScriptsInstalling rst2pseudoxml.py script to C:\Python33\ScriptsInstalling rst2s5.py script to C:\Python33\ScriptsInstalling rst2xetex.py script to C:\Python33\ScriptsInstalling rst2xml.py script to C:\Python33\ScriptsInstalling rstpep2html.py script to C:\Python33\ScriptsInstalled c:\python33\lib\site-packages\docutils-0.12-py3.3.eggSearching for Pygments>=1.2Reading https://pypi.python.org/simple/Pygments/Best match: Pygments 2.0.1Downloading https://pypi.python.org/packages/source/P/Pygments/Pygments-2.0.1.tar.gz#md5=e0daf4c14a4fe5b630da765904de4d6cProcessing Pygments-2.0.1.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-21gbrh\Pygments-2.0.1\setup.cfgRunning Pygments-2.0.1\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-21gbrh\Pygments-2.0.1\egg-dist-tmp-m44clwAdding pygments 2.0.1 to easy-install.pth fileInstalling pygmentize-script.py script to C:\Python33\ScriptsInstalling pygmentize.exe script to C:\Python33\ScriptsInstalled c:\python33\lib\site-packages\pygments-2.0.1-py3.3.eggSearching for Jinja2>=2.3Reading https://pypi.python.org/simple/Jinja2/Best match: Jinja2 2.7.3Downloading https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.7.3.tar.gz#md5=b9dffd2f3b43d673802fe857c8445b1aProcessing Jinja2-2.7.3.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-t76yf3\Jinja2-2.7.3\setup.cfgRunning Jinja2-2.7.3\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-t76yf3\Jinja2-2.7.3\egg-dist-tmp-0oouy9warning: no files found matching '*' under directory 'custom_fixers'warning: no previously-included files matching '*' found under directory 'docs\_build'warning: no previously-included files matching '*.pyc' found under directory 'jinja2'warning: no previously-included files matching '*.pyc' found under directory 'docs'warning: no previously-included files matching '*.pyo' found under directory 'jinja2'warning: no previously-included files matching '*.pyo' found under directory 'docs'Adding jinja2 2.7.3 to easy-install.pth fileInstalled c:\python33\lib\site-packages\jinja2-2.7.3-py3.3.eggSearching for six>=1.4Reading https://pypi.python.org/simple/six/Best match: six 1.8.0Downloading https://pypi.python.org/packages/source/s/six/six-1.8.0.tar.gz#md5=1626eb24cc889110c38f7e786ec69885Processing six-1.8.0.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-xs_11x\six-1.8.0\setup.cfgRunning six-1.8.0\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-xs_11x\six-1.8.0\egg-dist-tmp-btm92uno previously-included directories found matching 'documentation\_build'zip_safe flag not set; analyzing archive contents...__pycache__.six.cpython-33: module references __path__Adding six 1.8.0 to easy-install.pth fileInstalled c:\python33\lib\site-packages\six-1.8.0-py3.3.eggSearching for pytz>=0aReading https://pypi.python.org/simple/pytz/Best match: pytz 2014.10Downloading https://pypi.python.org/packages/3.3/p/pytz/pytz-2014.10-py3.3.egg#md5=e03d72ef688816e8ffbd0bbe28f4ad93Processing pytz-2014.10-py3.3.eggMoving pytz-2014.10-py3.3.egg to c:\python33\lib\site-packagesAdding pytz 2014.10 to easy-install.pth fileInstalled c:\python33\lib\site-packages\pytz-2014.10-py3.3.eggSearching for markupsafeReading https://pypi.python.org/simple/markupsafe/Best match: MarkupSafe 0.23Downloading https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz#md5=f5ab3deee4c37cd6a922fb81e730da6eProcessing MarkupSafe-0.23.tar.gzWriting c:\users\admini~1\appdata\local\temp\easy_install-17k64l\MarkupSafe-0.23\setup.cfgRunning MarkupSafe-0.23\setup.py -q bdist_egg --dist-dir c:\users\admini~1\appdata\local\temp\easy_install-17k64l\MarkupSafe-0.23\egg-dist-tmp-kicia0_speedups.c_speedups.obj : warning LNK4197: 多次指定导出“PyInit__speedups”;使用第一个规范   正在创建库 build\temp.win-amd64-3.3\Release\markupsafe\_speedups.lib 和对象 build\temp.win-amd64-3.3\Release\markupsafe\_speedups.expAdding markupsafe 0.23 to easy-install.pth fileInstalled c:\python33\lib\site-packages\markupsafe-0.23-py3.3-win-amd64.eggFinished processing dependencies for sphinx
出现Finished processing dependencies for sphinx,会在C:\Python33\Scripts里发现如图中的内容
到这里,sphinx的配置已经成功!


二、使用sphinx

使用sphinx的build命令,sphinx builde语法 :

$ sphinx-build [options] sourcedir builddir [filenames]
具体操作:命令行里输入 sphinx-build sourcedir builddir,其中sourcedir即含有 conf.py 文件的路径,builddir是要生成网页的目录。命令行里出现build succeeded这种提示,在目录下就可以看网页的文档了。

参考网址及相关资源:

http://www.ibm.com/developerworks/cn/opensource/os-sphinx-documentation/

http://www.cnblogs.com/Romantic/articles/3586229.html

http://mars914.iteye.com/blog/1870404

http://stackoverflow.com/questions/3652625/installing-setuptools-on-64-bit-windows/3652687#3652687

http://blog.csdn.net/siren0203/article/details/5564082

https://pypi.python.org/pypi/setuptools#windows-simplified

http://blog.csdn.net/boss_t/article/details/14101539

http://blog.csdn.net/boss_t/article/details/14089767  python3的学习资料,这个不错,感谢!

http://www.pythondoc.com/sphinx/invocation.html

https://pip.pypa.io/en/latest/installing.html

http://www.cnblogs.com/yanhuiw/p/3756085.html

0 0
原创粉丝点击