Anaconda Spyder无法识别的修改后的PYTHONPATH [英] modified PYTHONPATH not recognized by Anaconda Spyder
问题描述
我使用我的.bash_profile将目录添加到PYTHONPATH
I use my .bash_profile to add a directory to PYTHONPATH
export PYTHONPATH="${PYTHONPATH}:/Users/selah/newdir"
在我的Anaconda Spyder安装中,当我键入以下内容时,添加的路径不会显示:
In my Anaconda installation of Spyder the path I added does not show up when I type:
import sys
sys.paths
但是,当我在Jupyter笔记本或终端python中执行相同操作时,它确实会显示.
However when i do the same in Jupyter notebook, or terminal python it does show up.
为什么会有差异?有没有办法让Spyder识别我修改过的PYTHONPATH?
Why the discrepancy? Is there a way to get Spyder to recognize my modified PYTHONPATH?
推荐答案
(此处为 Spyder开发人员),您需要从命令行启动Spyder,Spyder才能检测到您的更改.
(Spyder developer here) You need to start Spyder from the command line for your changes to be detected by Spyder.
这是因为Spyder无法以图形方式启动时读取环境变量.
This is because Spyder doesn't have a way to read your environment variables when started in a graphical way.
这篇关于Anaconda Spyder无法识别的修改后的PYTHONPATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!