【问题标题】:How to use both Python 2.5 and Python 2.7 with GAE on one PC?如何在一台 PC 上同时使用 Python 2.5 和 Python 2.7 和 GAE?
【发布时间】:2013-09-21 12:13:57
【问题描述】:

我有使用 Python 2.5 和 Python 2.7 的 GAE 项目。所以,我应该能够同时使用这两个版本。我已将 2 个版本安装到不同的文件夹中(d:\Work\Python25\d:\Work\Python27\)。在它们之间切换最简单的方法是什么?

我试过用:

start d:\Work\Python27\python.exe d:\Work\GAE\dev_appserver.py %~dp0

但如果失败并出现以下异常:

Traceback (most recent call last):
  File "d:\Work\GAE\dev_appserver.py", line 171, in <module>
    run_file(__file__, globals())
  File "d:\Work\GAE\dev_appserver.py", line 167, in run_file
    execfile(script_path, globals_)
  File "d:\Work\GAE\google\appengine\tools\dev_appserver_main.py", line 165, in
<module>
    from google.appengine.tools import dev_appserver
  File "d:\Work\GAE\google\appengine\tools\dev_appserver.py", line 197, in <modu
le>
    mimetypes.add_type(mime_type, '.' + ext)
  File "d:\Work\Python27\lib\mimetypes.py", line 344, in add_type
    init()
  File "d:\Work\Python27\lib\mimetypes.py", line 355, in init
    db.read_windows_registry()
  File "d:\Work\Python27\lib\mimetypes.py", line 259, in read_windows_registry
    for ctype in enum_types(mimedb):
  File "d:\Work\Python27\lib\mimetypes.py", line 249, in enum_types
    ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal
not in range(128)

【问题讨论】:

    标签: google-app-engine python-2.7 python-2.5


    【解决方案1】:

    我从未在 Windows PC 上尝试过,但在 Linux 上的这种情况下,virtualenv 是你的朋友。

    【讨论】:

      【解决方案2】:

      我描述的问题与两个版本的使用无关,而是 python 2.7 问题 - https://stackoverflow.com/a/4238212/604388。修复后,我可以按照问题中的说明使用 python 2.7。

      【讨论】:

        猜你喜欢
        • 2016-11-26
        • 2012-09-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-08-19
        • 1970-01-01
        • 2010-10-29
        相关资源
        最近更新 更多