Python: cannot import urandom module (OS X)

前端 未结 1 1616
半阙折子戏
半阙折子戏 2021-01-05 00:24

I\'m quite ashamed to ask a question like this one, but I\'ve been trying for a couple of hours already...it seems I can\'t get my python version to do random things anymore

1条回答
  •  醉梦人生
    2021-01-05 00:37

    Ok, I figured it out. I had a dirty hash table in my terminal.

    Solution:

    hash -r  # will erase the currently used hash table
    

    Once this was done, I ran python again and I got:

    Python 2.7.3 (default, Apr 19 2012, 00:55:09) 
    [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import random
    >>> import os; os
    
    

    Note the different python version (2.7.3 vs 2.7.1 before). I think this is due to an earlier install of python 2.3 via mac port.

    Sorry for the question/quick answer :/

    Have a good night!
    Arnaud

    0 讨论(0)
提交回复
热议问题