我已经将Spyder 2.7首选项设置如下: Preferences->Run-> General Settings-> Default working directory is: the script但是,对于特定的脚本,spyder会将工作目录设置为父目录。
我在同一个目录中有一些脚本,这些脚本不会表现出这种行为,并使用预期
我一直试图获取打开的.py文件(使用Spyder)的位置,该文件将用于链接各种文件并使用__file__名称,以便任何机器都可以从其当前目录运行。= os.path.abspath(os.path.dirname(__file__))NameError: name '__file__' is not definedlocation = os.path.abspath(os.pa