2013-03-15 108 views
0

当我尝试运行金字塔导入错误:没有模块名为RFC822金字塔蟒蛇

[~/env/MyStore]# ../bin/pserve development.ini 

它会显示以下错误

File "/home/vretinfo/env/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste/fileapp.py", line 14, in <module> 
    from paste.httpheaders import * 
File "/home/vretinfo/env/lib/python3.2/site-packages/Paste-1.7.5.1-py3.2.egg/paste/httpheaders.py", line 140, in <module> 
    from rfc822 import formatdate, parsedate_tz, mktime_tz 
ImportError: No module named rfc822 

我应该如何解决这个问题?


这就是我所做的安装

$ mkdir opt 
$ cd opt 
$ wget http://python.org/ftp/python/3.2.3/Python-3.2.3.tgz 
$ tar -xzf Python-3.2.3.tgz 
$ cd Python-3.2.3 

的./configure --prefix = $ HOME /选择/ Python的3.2.3

$ make; 
$ make install 
$ cd ~ 
$ wget http://python-distribute.org/distribute_setup.py 
$ pico distribute_setup.py 
* change first line to opt/Python-3.2.3/python 
$ opt/Python-3.2.3/bin/python3.2 distribute_setup.py 
$ opt/Python-3.2.3/bin/easy_install virtualenv 
$ opt/Python-3.2.3/bin/virtualenv --no-site-packages env 
$ cd env 
$ ./bin/pip install passlib 
$ ./bin/pip install pyramid_beaker 
$ ./bin/pip install pyramid_mailer 
$ ./bin/pip install pyramid_mongodb 
$ ./bin/pip install pyramid_jinja2 
$ ./bin/pip install Werkzeug 
$ ./bin/pip install pyramid 
$ ./bin/pcreate -s pyramid_mongodb MyShop 
$ cd MyShop 
$ ../bin/python setup.py develop 
$ ../bin/python setup.py test -q 

好,我已经在金字塔文档中进行了一些搜索(http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/paste.html)。 它指出第3款

"However, all Pyramid scaffolds render PasteDeploy configuration files, to provide new developers with a standardized way of setting deployment values, and to provide new users with a standardized way of starting, stopping, and debugging an application."

所以我做了修改development.ini和更换

[server:main] 
use = egg:waitress#main 

和setup.py,我说“女招待”到需要阵列

下一步,我完全删除了/ home/vretinfo/env/ECommerce /中与粘贴有关的所有内容,

$ rm -rf Paste*;rm -rf paste* 

在此之后,我试着重新运行测试-q,这是堆栈跟踪:

[~/env/ECommerce]# ../bin/python setup.py test -q 

/home/vretinfo/opt/Python-3.2.3/lib/python3.2/distutils/dist.py:257: UserWarning: Unknown distribution option: 'paster_plugins' 
warnings.warn(msg) 
running test 
Checking .pth file support in . 
/home/vretinfo/env/ECommerce/../bin/python -E -c pass 
Searching for Paste>=1.7.1 
Reading http://pypi.python.org/simple/Paste/ 
Reading http://pythonpaste.org 
Best match: Paste 1.7.5.1 
Downloading http://pypi.python.org/packages/source/P/Paste/Paste-1.7.5.1.tar.gz#md5=7ea5fabed7dca48eb46dc613c4b6c4ed 
Processing Paste-1.7.5.1.tar.gz 
Writing /tmp/easy_install-q5h5rn/Paste-1.7.5.1/setup.cfg 
Running Paste-1.7.5.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-q5h5rn/Paste-1.7.5.1/egg-dist-tmp-e3nvmj 
warning: no previously-included files matching '*' found under directory 'docs/_build/_sources' 

好像是需要pyramid1.4出于某种原因粘贴。也许有人对此有一些见解。

+0

考虑到您使用标准配置选项构建了python,请尝试使用'ls /usr/lib/python3.2 | grep“rfc822”'。你的产量是多少? – eazar001 2013-03-15 07:06:41

+1

@ eazar001:该模块已在Python 3中删除。Paste是* not * python 3兼容,我很惊讶地发现它被使用。 – 2013-03-15 10:48:57

+2

这是什么版本的金字塔?'Paste'依赖已经在几个版本之前被移除*,因为它在Python 3 *上不起作用。 – 2013-03-15 10:49:57

回答

0

我已经设法通过IRC#金字塔中的人解决了这个问题。我在这里发布解决方案,以防将来遇到有人遇到。我已经在Python3.2中测试过了,现在可以正常工作。

运行后./bin/pcreate -s < ...>

项目的文件夹中

,development.ini

更改如下:

1. in the 1st line, rename [app:<Project>] to [app:main] 

    2. [server:main] 
     If it is egg:Paste#http, change it to 

     use = egg:waitress#main 

    3. remove [pipeline:main] and its section 
在同一

文件夹,对setup.py进行必要的更改:

1. requires = [....], add in waitress into the array, remove WebError from the array 
    2. remove paster_plugins=['pyramid'] 

然后最后,运行

$ ../bin/python setup.py develop 

粘贴将不会被安装或检查,如果它存在。

相关问题