Permanently add a directory to PYTHONPATH?

前端 未结 19 1635
别那么骄傲
别那么骄傲 2020-11-22 01:12

Whenever I use sys.path.append, the new directory will be added. However, once I close python, the list will revert to the previous (default?) values. How do I

19条回答
  •  余生分开走
    2020-11-22 01:38

    On MacOS, Instead of giving path to a specific library. Giving full path to the root project folder in

    ~/.bash_profile 
    

    made my day, for example:

    export PYTHONPATH="${PYTHONPATH}:/Users//project_root_folder_path"
    

    after this do:

    source ~/.bash_profile
    

提交回复
热议问题