modified PYTHONPATH not recognized by Anaconda Spyder

时光毁灭记忆、已成空白 提交于 2019-12-12 04:21:38

问题


I use my .bash_profile to add a directory to PYTHONPATH

export PYTHONPATH="${PYTHONPATH}:/Users/selah/newdir"

In my Anaconda installation of Spyder the path I added does not show up when I type:

import sys
sys.paths

However when i do the same in Jupyter notebook, or terminal python it does show up.

Why the discrepancy? Is there a way to get Spyder to recognize my modified PYTHONPATH?


回答1:


(Spyder developer here) You need to start Spyder from the command line for your changes to be detected by Spyder.

This is because Spyder doesn't have a way to read your environment variables when started in a graphical way.




回答2:


I had a similar problem. For future reference, resolved by adding path under menu “python > PYTHONPATH manager” option.



来源:https://stackoverflow.com/questions/45086454/modified-pythonpath-not-recognized-by-anaconda-spyder

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