12

我安装在我的新 Windows 8 (x64) 中:

  • python-2.7
  • pywin32-218.win32-py2.7
  • setuptools-0.6c11.win32-py2.7
  • 和金字塔(通过easy_install)

我试图运行我的金字塔项目:

pserve I:\Projects\PyramidProject\development.ini

并提出了 pkg_resources.DistributionNotFound(req) :

追溯

 I:\Projects\MyProject>pserve development.ini Traceback (most recent
 call last):   File "C:\Python27\Scripts\pserve-script.py", line 9, in
 <module>
     load_entry_point('pyramid==1.4b1', 'console_scripts', 'pserve')()   File
 "C:\Python27\lib\site-packages\pyramid-1.4b1-py2.7.egg\pyramid\scripts\ps
 erve.py", line 50, in main
     return command.run()   File "C:\Python27\lib\site-packages\pyramid-1.4b1-py2.7.egg\pyramid\scripts\ps
 erve.py", line 301, in run
     relative_to=base, global_conf=vars)   File "C:\Python27\lib\site-packages\pyramid-1.4b1-py2.7.egg\pyramid\scripts\ps
 erve.py", line 332, in loadserver
     server_spec, name=name, relative_to=relative_to, **kw)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 255, in loadserver
     return loadobj(SERVER, uri, name=name, **kw)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 271, in loadobj
     global_conf=global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 296, in loadcontext
     global_conf=global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 320, in _loadconfig
     return loader.get_context(object_type, name, global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 454, in get_context
     section)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 476, in _context_from_use
     object_type, name=use, global_conf=global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 406, in get_context
     global_conf=global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 296, in loadcontext
     global_conf=global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 328, in _loadegg
     return loader.get_context(object_type, name, global_conf)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 620, in get_context
     object_type, name=name)   File "C:\Python27\lib\site-packages\pastedeploy-1.5.0-py2.7.egg\paste\deploy\l
 oadwsgi.py", line 640, in find_egg_entry_point
     pkg_resources.require(self.spec)   File "C:\Python27\lib\site-packages\distribute-0.6.32-py2.7.egg\pkg_resources.
 py", line 690, in require
     needed = self.resolve(parse_requirements(requirements))   File "C:\Python27\lib\site-packages\distribute-0.6.32-py2.7.egg\pkg_resources.
 py", line 588, in resolve
     raise DistributionNotFound(req) pkg_resources.DistributionNotFound: Paste

我的开发.ini:

[app:MyProject]
use = egg:MyProject
pyramid.reload_all = true
pyramid.reload_templates = true
pyramid.reload_assets = true
pyramid.debug_all = false
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.debug_templates = true
mako.directories = app:view
mako.module_directory = %(here)s/cache/templates/
#mako.cache_type = file
#mako.cache_enabled = False
#mako.cache_dir = %(here)s/cache/view/
#mako.cache_impl = beaker
#mako.cache_timeout = 60
mako.input_encoding = utf-8
mako.imports = from markupsafe import escape_silent
mako.default_filters = escape_silent
#mako.error_handler =
sqlalchemy.url = mysql://user:mypassword@mysql.mydomain.com/MyProject_dev?charset=utf8
sqlalchemy.pool_recycle = 3600
beaker.session.type = file
beaker.session.cookie_expires = True
beaker.session.cookie_domain = MyProject.pl
beaker.session.data_dir = %(here)s/data/sessions/data
beaker.session.lock_dir = %(here)s/data/sessions/lock
beaker.session.key = MyProject.pl
beaker.session.secret = 57b0d7ff4c665d87e3c3745c2abf519ca7d4082a
beaker.session.validate_key = 57b0d7ff
beaker.cache.enabled = True
beaker.cache.type = memory
beaker.cache.data_dir = %(here)s/cache/data
beaker.cache.lock_dir = %(here)s/cache/lock 
beaker.cache.regions = default_term, second_term, minute_term, hour_term, day_term, month_term, short_term, middle_term, long_term, 
beaker.cache.second_term.expire = 1
beaker.cache.minute_term.expire = 60
beaker.cache.hour_term.expire = 3600
beaker.cache.day_term.expire = 86400
beaker.cache.month_term.expire = 2678400
beaker.cache.default_term.expire = 60
beaker.cache.short_term.expire = 30
beaker.cache.middle_term.expire = 300
beaker.cache.long_term.expire = 86400
site.front.default_skin = MyProject
site.front.available_skins = default mobile MyProject
default_skin = MyProject
available_skins = default mobile MyProject

[filter:tm]
use = egg:repoze.tm2#tm
commit_veto = repoze.tm:default_commit_veto

[pipeline:main]
pipeline =
    egg:WebError#evalerror
    tm
    MyProject

[server:main]
use = egg:Paste#http
host = 127.0.0.1
port = 5000

# Begin logging configuration

[loggers]
keys = root, MyProject, sqlalchemy

[handlers]
keys = console

[formatters]
keys = generic

[logger_root]
level = INFO
handlers = console

[logger_MyProject]
level = DEBUG
handlers =
qualname = MyProject

[logger_sqlalchemy]
level = INFO
handlers =
qualname = sqlalchemy.engine
# "level = INFO" logs SQL queries.
# "level = DEBUG" logs SQL queries and results.
# "level = WARN" logs neither.  (Recommended for production systems.)

[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic

[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s

# End logging configuration

你有什么想法,我做错了什么?

4

1 回答 1

18

你需要在你的 virtualenveasy_install paste中运行。python setup.py develop

附带说明,您使用的是非常旧版本的金字塔。我知道这是因为您的项目使用 weberror、repoze.tm2 和粘贴。如果您有时间,我建议您考虑升级到一些最佳实践。

于 2012-12-02T02:07:43.763 回答