Set LD_LIBRARY_PATH before importing in python

后端 未结 5 789
鱼传尺愫
鱼传尺愫 2020-12-05 13:08

Python uses the PYTHONPATH environment-variable to determine in which folders it should look for modules. You can play around with it by modifying sys.pat

5条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 13:44

    The solution works fine if the env is reinit

    import os
    
    os.environ['LD_LIBRARY_PATH'] = os.getcwd()  # or whatever path you want 
    

    The code need to be taken in place....

    os.execv(sys.argv[0], sys.argv)
    

提交回复
热议问题