ImportError: cannot import name urandom Eclipse/PyDev

不想你离开。 提交于 2019-12-13 18:26:39

问题


I know this question has been asked many times, but I couldn't manage to solve it on my own. So please bear with me.

Traceback (most recent call last):
      File "/Users/someone/Desktop/eclipse/plugins/org.python.pydev_2.6.0.2012062818/pysrc/pydevd.py", line 3, in <module>
        import pydev_imports
      File "/Users/someone/Desktop/eclipse/plugins/org.python.pydev_2.6.0.2012062818/pysrc/pydev_imports.py", line 14, in <module>
        from _pydev_SimpleXMLRPCServer import SimpleXMLRPCServer
      File "/Users/someone/Desktop/eclipse/plugins/org.python.pydev_2.6.0.2012062818/pysrc/_pydev_SimpleXMLRPCServer.py", line 116, in <module>
        import BaseHTTPServer
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/BaseHTTPServer.py", line 81, in <module>
        import mimetools
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py", line 6, in <module>
        import tempfile
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 34, in <module>
        from random import Random as _Random
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 47, in <module>
        from os import urandom as _urandom
    ImportError: cannot import name urandom

echo $PATH gave me this. /Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

My goal is to setup an IDE that gives me code completion and breakpoint debug(like java, so that I can debug it line by line). I've read many posts here, but still haven't find a solution to it. Can anyone point to the right direction? Thanks in advance.

Edit: I upgraded python to 2.7.3 because i couldn't select the interpreter in eclipse preferences.


回答1:


Take a look at this link. All you need to do is make a proper configuration of your interpreter.
If it doesn't help, you should take a look at another one (the second one is about urandom module, whilst the first one about pydev configuration).



来源:https://stackoverflow.com/questions/12689463/importerror-cannot-import-name-urandom-eclipse-pydev

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!