0
我有一個python文件,不會正確執行導入。瘋狂的python導入錯誤
如果我轉到python提示符,我可以手動導入模塊而不會出錯。
Python 2.4.3 (#1, Feb 22 2012, 16:06:13)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from amqplib import client_0_8 as amqp
當我通過程序步驟與PDB,執行導入的結果:
-> from amqplib import client_0_8 as amqp
(Pdb) s
--Call--
> /home/ralphie/Desktop/Projects/catamaran/build/bdist.linux-i686/egg/amqplib/__init__.py(0)?()
當我檢查的sys.path:
Python 2.4.3 (#1, Feb 22 2012, 16:06:13)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from amqplib import client_0_8 as amqp
>>> import sys
>>> print sys.path
['', '/usr/lib/python2.4/site-packages/setuptools-0.6c11-py2.4.egg',
'/usr/lib /python2.4/site-packages/mechanize-0.2.5-py2.4.egg',
'/usr/lib/python2.4/site-packages/ClientForm-0.2.10-py2.4.egg',
'/usr/lib/python2.4/site-packages/simplejson-2.3.2-py2.4-linux-i686.egg',
'/usr/lib/python2.4/site-packages/amqplib-1.0.0-py2.4.egg',
'/usr/lib/python24.zip',
'/usr/lib/python2.4',
'/usr/lib/python2.4/plat-linux2',
'/usr/lib/python2.4/lib-tk',
'/usr/lib/python2.4/lib-dynload',
'/usr/lib/python2.4/site-packages',
'/usr/lib/python2.4/site-packages/Numeric',
'/usr/lib/python2.4/site-packages/PIL',
'/usr/lib/python2.4/site-packages/gtk-2.0']
它不是從環境來變量,我已刪除所有.pyo & .pyc文件。
我只是不知道那個瘋狂的雞蛋參考來自哪裏。
任何線索真誠讚賞。
那麼,錯誤是什麼? – Marcin 2012-03-29 17:59:15
您正在使用哪種操作系統? – 2012-03-29 17:59:34
它也取決於你從哪裏打開你的Python提示符.. – 2012-03-29 18:00:43