2

我有安装了 setuptools 的 Windows 7 和 Python 2.7。

下载 pitz 模块(easy_install pitz)后,Google App Engine 停止工作:

bad runtime process port ['']

Traceback (most recent call last):
  File "G:\Program Files (x86)\Google\google_appengine\_python_runtime.py", line 184, in <module>
    _run_file(__file__, globals())
  File "G:\Program Files (x86)\Google\google_appengine\_python_runtime.py", line 180, in _run_file
    execfile(script_path, globals_)
  File "G:\Program Files (x86)\Google\google_appengine\google\appengine\tools\devappserver2\python\runtime.py", line 28, in <module>
    from google.appengine.ext.remote_api import remote_api_stub
  File "G:\Program Files (x86)\Google\google_appengine\google\appengine\ext\remote_api\remote_api_stub.py", line 75, in <module>
    import yaml
  File "G:\Program Files (x86)\Google\google_appengine\lib\yaml-3.10\yaml\__init__.py", line 14, in <module>
    from cyaml import *
  File "G:\Program Files (x86)\Google\google_appengine\lib\yaml-3.10\yaml\cyaml.py", line 5, in <module>
    from _yaml import CParser, CEmitter
  File "C:\Python27\lib\site-packages\pyyaml-3.11-py2.7-win-amd64.egg\_yaml.py", line 7, in <module>
  File "C:\Python27\lib\site-packages\pyyaml-3.11-py2.7-win-amd64.egg\_yaml.py", line 4, in __bootstrap__
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 950, in resource_filename
    self, resource_name
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 1607, in get_resource_filename
    self._extract_resource(manager, self._eager_to_zip(name))
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 1667, in _extract_resource
    manager.extraction_error()
  File "C:\Python27\lib\site-packages\pkg_resources.py", line 996, in extraction_error
    raise err
pkg_resources.ExtractionError: Can't extract file(s) to egg cache

The following error occurred while trying to extract file(s) to the Python egg
cache:

  [Error 5] : 'C:\\Users\\Kostr\\AppData\\Roaming\\Python-Eggs\\pyyaml-3.11-py2.7-win-amd64.egg-tmp\\_yaml.pyd'

The Python egg cache directory is currently set to:

  C:\Users\Kostr\AppData\Roaming\Python-Eggs

Perhaps your account does not have write access to this directory?  You can
change the cache directory by setting the PYTHON_EGG_CACHE environment
variable to point to an accessible directory.

如何解决这个问题?

4

2 回答 2

3

来自:https ://code.google.com/p/modwsgi/wiki/ApplicationIssues

为了避免这个特殊问题,您可以PYTHON_EGG_CACHE在 WSGI 应用程序脚本文件的开头设置缓存环境变量。环境变量应设置为一个目录,该目录由运行 Apache 的用户拥有和/或可写。

import os
os.environ['PYTHON_EGG_CACHE'] = '/usr/local/pylons/python-eggs' 

再次,确保它存在。对于 Windows 用户,可能类似于:

os.environ['PYTHON_EGG_CACHE'] = '/tmp'

或者,如果使用 mod_wsgi 2.0,也可以对在嵌入式模式下运行的应用程序使用 WSGIPythonEggs 指令,或者python-eggs在使用守护程序模式时使用 WSGIDaemonProcess 指令的选项。

请注意,您应该避免使用任何人都可写的目录或文件,因为这可能会危及安全性。另请注意,如果在同一 Web 服务器下托管多个应用程序,它们都将作为同一用户运行,因此每个应用程序都可以查看和修改彼此的文件。如果这是一个问题,您应该将应用程序托管在作为不同用户或不同系统运行的不同 Web 服务器上。或者,应用程序需要或更新的任何数据都应托管在数据库中,每个应用程序都有单独的帐户。

于 2014-06-15T15:36:23.770 回答
2

听起来您没有写入目录的权限。卸载 pitz,然后使用 -Z 标签重新安装以将其安装为解压缩版本。然后,您不需要每次都提取缓存目录。那应该解决目录/权限问题。

于 2014-06-15T17:23:09.467 回答