如何在一台PC上使用带有GAE的Python 2.5和Python 2.7?

时间:2013-09-21 12:13:58

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

我有使用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)

2 个答案:

答案 0 :(得分:1)

我从来没有在Windows PC上试过这个,但在Linux上这种情况下,virtualenv是你的朋友。

答案 1 :(得分:0)

我所描述的问题与两个版本的使用无关,但python 2.7问题 - https://stackoverflow.com/a/4238212/604388。修复之后,我可以使用问题中描述的python 2.7。