2014-02-21 57 views
0

當我試圖啓動與金字塔開發的應用無法導入名逃跑,我得到的錯誤導入錯誤:空空金字塔

from pyramid.compat import configparser 
File "/srv/lightbase/lib/python3.3/site-packages/pyramid-1.5b1-py3.3.egg/pyramid/compat.py", line 205, in <module> 
    from html import escape 
ImportError: cannot import name escape 

當試圖點子安裝HTML,我得到的錯誤:

ImportError: No module named 'html.entities'; html is not a package 

我使用virtualenv與python3.3.4編譯使用'--enable-shared'代碼使用mod_wsgi。

+0

Python 3.3中有''html.escape()'函數](http://hg.python.org/cpython/file/3.3/Lib/html/__init__.py#l12) – jfs

+0

所以這是金字塔錯誤? – Rickin

+0

這是不可能的。你可以在同一個環境中運行'from import import escape',但是沒有'pyramid'?你的'sys.path'中有一個不是來自stdlib的頂級'html'模塊嗎? '打印(HTML文件.__ __)'。 – jfs

回答

0

我使用的python版本是從最新的代碼版本編譯而來的,我使用的是從debian 6默認存儲庫預編譯的mod_wsgi,刪除它並用最新版本編譯我自己的mod_wsgi足以解決問題。我認爲這意味着他們不兼容。

由於 pip install html/ easy_install html沒有工作,符號鏈接 /usr/local/python3.3/html到的virtualenv站點包文件夾中所做的解釋它讀成一個包。 這可能不是最好的解決方案,但我會將其作爲正確的答案,直到有更好的選擇。

+0

'html'是標準庫的一部分。如果將它鏈接到'site-packages'文件夾有幫助,那麼你所做的只是讓它出現在'sys.path'搜索順序的其他位置,然後才能找到另一個破壞你的代碼的版本。 –

+0

@MartijnPieters你說得對,問題在於我的mod_wsgi版本沒有在尋找標準庫,我猜想他們在olders上存儲的方式有所改變python3版本 – Rickin