6

I have installed pyramid and successfully created a project, but when I try to add new packages to the setup.py requirements they always give me a pkg_resources.DistributionNotFound error.

The packages are installed, and this only happens if I try to install new packages after I run ../bin/python3.3 setup.py develop It doesn't matter what packages it is.

The only way I have solved (not really), is setting up a new virtual environment and installing the packages before I create the project and run setup.py develop.

Obviously I'm doing something wrong. Is there anything I need to do beside pip install the package? Is this some kind of pathing issue? I'm new to this so your help would be so very appreciated!

*Adding my installation process in case anyone happens to see something wrong with it. Also including my wsgi file.

Created a virtualenv easy_install-3.3 env

Activated the virtualenv source env/bin/activate

Installed pyramid cd env ./bin/easy_install-3.3 pyramid

Created a project ./bin/pcreate -s starter myprojectname

Ran setup.py cd myprojectname ../bin/python3.3 setup.py develop

At this point I get the following error: pkg_resources.DistributionNotFound: waitress

Installed Waitress ../bin/easy_install-3.3 waitress

Ran setup.py again (not sure if I should be doing this) ../bin/python3.3 setup.py develop

Still see the error

My .wsgi file contains the following (not sure if this is important to this question or not): activate_this = "/home/account/env/bin/activate_this.py" execfile(activate_this,dict(__file__=activate_this))

import os import sys

path = '/home/account/env/lib/python3.3/site-packages'

if path not in sys.path: sys.path.append(path)

from pyramid.paster import get_app application = get_app('/home/account/env/myprojectname/production.ini', 'main')

4

2 回答 2

5

使用上面迈克尔的建议,我能够解决他的问题。我什至不需要手动安装任何软件包。一旦一切正常,如果我向我的 setup.py 文件(创建金字塔项目时创建)添加了一个要求并运行 pip install -e 。一切都再次完美安装。问题是由我安装东西的方式引起的。这是我的最后一个过程,以防它帮助任何其他新手金字塔:

  1. 创建了一个虚拟环境 virtualenv-3.3 env

  2. 激活环境 source env/bin/activate

  3. 移动到环境目录 cd env

  4. 安装金字塔 pip install pyramid

  5. 创建了一个项目 ./bin/pcreate -s starter myprojectname

  6. 移动到我的项目目录 cd megaproject

  7. 跑安装 pip install -e .

  8. 用我的环境和项目设置更新了我的 wsgi 文件

  9. 重新加载应用程序并高兴地看到可爱的金字塔起始页

于 2013-06-21T17:38:08.977 回答
3

点子,setup.py develop不应该混合。后者在命名空间包的情况下使用与 pip 不兼容的 easy_install(这些包作为另一个父级的子包安装,例如 zope.sqlalchemy 仅安装完整 zope.* 包的 .sqlalchemy 部分)。命名空间包导致 pip 和 easy_install 之间出现问题。另一方面,大多数其他软件包都可以在您选择的任何系统上正常工作,但最好保持一致。

要仔细检查的另一件事是,您实际上是在将软件包安装到您的 virtualenv 中。您应该能够在您的 virtualenv 中打开 python cli 并导入包。如果你不能,那么它可能没有安装。

于 2013-06-20T18:46:48.023 回答