使用 easy_install 升级 Python Sphinx

Upgrade Python Sphinx with easy_install

我正在使用 Portable Python 2.7.6.1 并安装了 Sphinx 1.5.1 以创建我的手册。由于 Sphinx 在过去几个月里已经取得了很大进展,我试图更新到最新版本 Sphinx 1.6.5,但我无法使用 easy_install 工具进行升级。

我试过了:

easy_install-2.7.exe -U sphinx

它说:

Searching for sphinx
Reading http://pypi.python.org/simple/sphinx/
Couldn't retrieve index page for 'sphinx'
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
Best match: sphinx 1.5.1
Processing sphinx-1.5.1-py2.7.egg
sphinx 1.5.1 is already the active version in easy-install.pth

之后我试图强制版本,但这也失败了:

easy_install-2.7.exe -m 1.6.5 sphinx

是这样说的:

Searching for 1.6.5
Reading http://pypi.python.org/simple/1.6.5/
Couldn't find index page for '1.6.5' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for 1.6.5
Best match: None
Traceback (most recent call last):
  File "C:\Data\Frank\Programme\Portable Python 2.7.6.1\App\Scripts\easy_install-2.7-script.py", line 8, in <module>
    load_entry_point('setuptools==0.6c11', 'console_scripts', 'easy_install-2.7')()
  File "C:\Data\Frank\Programme\Portable Python 2.7.6.1\App\lib\site-packages\setuptools\command\easy_install.py", line 1712, in main
    with_ei_usage(lambda:
  File "C:\Data\Frank\Programme\Portable Python 2.7.6.1\App\lib\site-packages\setuptools\command\easy_install.py", line 1700, in with_ei_usage
    return f()

我做错了什么?也许删除 sphinx 会有所帮助,但 easy-install 中似乎没有命令开关。

easy_install 的文档很简单。参见 upgrading a package

You don’t need to do anything special to upgrade a package: just install the new version, either by requesting a specific version, e.g.:

easy_install "SomePackage==2.0"

所以应该这样做:

easy_install "Sphinx==1.6.5"

另请参阅 uninstalling packages 和 easy_install。

If you want to delete the currently installed version of a package (or all versions of a package), you should first run:

easy_install -m PackageName

This will ensure that Python doesn’t continue to search for a package you’re planning to remove. After you’ve done this, you can safely delete the .egg files or directories, along with any scripts you wish to remove.