2011-05-08 80 views
0

所以我有ipython,它工作得很好。然後我使用buildout來安裝ipdb。 案例是:系統中的ipython和python2.7 家庭文件夾中的naked-python virtualenvs。 使用中的python2.4中的virtualenv從裸蟒蛇我現在提到因爲某種原因,ipython看着一個不同的python版本的virtualenv

我嘗試運行IPython中,我也得到

[email protected] ~ $ ipython 
/home/fakedrake/python/parts/opt/lib/python2.4/pprint.py:39: RuntimeWarning: Python C API version mismatch for module cStringIO: This Python has API version 1013, module cStringIO has versi 
on 1012.                                              
    from cStringIO import StringIO as _StringIO 
/home/fakedrake/python/parts/opt/lib/python2.4/string.py:528: RuntimeWarning: Python C API version mismatch for module strop: This Python has API version 1013, module strop has version 1012 
.                                               
    from strop import maketrans, lowercase, uppercase, whitespace 
/home/fakedrake/python/parts/opt/lib/python2.4/unittest.py:51: RuntimeWarning: Python C API version mismatch for module time: This Python has API version 1013, module time has version 1012. 
    import time 
/home/fakedrake/python/parts/opt/lib/python2.4/heapq.py:132: RuntimeWarning: Python C API version mismatch for module itertools: This Python has API version 1013, module itertools has versi 
on 1012.                                              
    from itertools import islice, repeat 
/home/fakedrake/python/parts/opt/lib/python2.4/bisect.py:82: RuntimeWarning: Python C API version mismatch for module _bisect: This Python has API version 1013, module _bisect has version 1 
012.                                               
    from _bisect import bisect_right, bisect_left, insort_left, insort_right, insort, bisect 
/home/fakedrake/python/parts/opt/lib/python2.4/heapq.py:306: RuntimeWarning: Python C API version mismatch for module _heapq: This Python has API version 1013, module _heapq has version 101 
2.                                               
    from _heapq import heappush, heappop, heapify, heapreplace, nlargest, nsmallest 
Traceback (most recent call last): 
    File "/usr/bin/ipython", line 26, in <module> 
    import IPython.Shell 
    File "/usr/lib/python2.7/site-packages/IPython/__init__.py", line 58, in <module> 
    __import__(name,glob,loc,[]) 
    File "/usr/lib/python2.7/site-packages/IPython/ipstruct.py", line 17, in <module> 
    from IPython.genutils import list2dict2 
    File "/usr/lib/python2.7/site-packages/IPython/genutils.py", line 20, in <module> 
    import doctest 
    File "/home/fakedrake/python/parts/opt/lib/python2.4/doctest.py", line 99, in <module> 
    import unittest, difflib, pdb, tempfile 
    File "/home/fakedrake/python/parts/opt/lib/python2.4/tempfile.py", line 33, in <module> 
    from random import Random as _Random 
    File "/home/fakedrake/python/parts/opt/lib/python2.4/random.py", line 41, in <module> 
    from warnings import warn as _warn 
    File "/home/fakedrake/python/parts/opt/lib/python2.4/warnings.py", line 258, in <module> 
    simplefilter("ignore", category=OverflowWarning, append=1) 
NameError: name 'OverflowWarning' is not defined 

如果您想了解有關該問題的任何進一步的信息主文件夾中的Plone實例只是告訴我,我不知道其他可能是相關的... (我運行arch-linux)

+0

您可能想要檢查您的PYTHONPATH環境變量。 – 2011-05-09 17:00:10

回答

0

爲什麼你有python2.4和python 2.7庫?當ipython(v2.7)導入doctest時,它將移入python2.4庫。我會檢查您的PYTHONPATH環境變量以及sys.path,即

import sys, os 
print '\n'.join([p for p in sys.path ]) 
print '\n'.join([[ for 

這個順序很重要。找出爲什麼要從該python2.4目錄導入doctest,然後從sys.path中刪除該目錄。根據here,OverflowWarning在升級到python2.5時被刪除。