0

我正在尝试根据此链接中给出的说明在 python3 虚拟环境中的本地系统(Ubuntu 14.04)中安装 readthedocs

当我运行pip3 install -r requirements.txt时,出现 Distutils2 错误。我删除了该依赖项,因为不再支持 distutils2 并且假设 setuptools 就足够了。

运行此命令 python manage.py migrate 给出以下错误:

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/apps/registry.py", line 115, in populate
    app_config.ready()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/contrib/admin/apps.py", line 22, in ready
    self.module.autodiscover()
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/contrib/admin/__init__.py", line 24, in autodiscover
    autodiscover_modules('admin', register_to=site)
  File "/home/username/read_the_docs_env/lib/python3.4/site-packages/django/utils/module_loading.py", line 74, in autodiscover_modules
    import_module('%s.%s' % (app_config.name, module_to_search))
  File "/home/username/read_the_docs_env/lib/python3.4/importlib/__init__.py", line 109, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
  File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
  File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1129, in _exec
  File "<frozen importlib._bootstrap>", line 1471, in exec_module
  File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
  File "/home/username/Desktop/CurrentProjects/read_the_docs/checkouts/readthedocs.org/readthedocs/core/admin.py", line 10, in <module>
    from readthedocs.core.views import SendEmailView
  File "/home/username/Desktop/CurrentProjects/read_the_docs/checkouts/readthedocs.org/readthedocs/core/views/__init__.py", line 26, in <module>
    from readthedocs.projects.tasks import remove_dir
  File "/home/username/Desktop/CurrentProjects/read_the_docs/checkouts/readthedocs.org/readthedocs/projects/tasks.py", line 493
    print "Sync Versions Exception: %s" % e.message
                                      ^
SyntaxError: Missing parentheses in call to 'print'

我从上面的堆栈跟踪中了解到代码在 python2 中,因此 print 语句在 python3 中是不同的。

这是否意味着我必须在 python2 virtualenv 中安装 readthedocs ?

我们不能在 readthedocs 内部服务器中托管 python3 项目的文档吗?

4

1 回答 1

1

阅读文档代码尚不支持 Python 3。安装说明明确表示要使用 Python 2.7 :

首先,获取 Python 2.7 和 virtualenv

但是,应该仍然可以使用您阅读的文档安装来托管 Python 3 项目的文档,因为说明随后说:

如果您计划将 Python 3 项目导入您的 RTD,那么您还需要在系统中安装带有 virtualenv 的 Python 3。

于 2016-07-26T10:00:20.373 回答