2013-03-15 133 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 

粘貼將不會被安裝或檢查,如果它存在。

相關問題