Python Spyder 3“设置控制台工作目录”不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39905258/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spyder 3 "Set Console Working Directory" not working
提问by fabio_hirono
I've been using Spyder 2 as my default Python IDE for a couple of years already, and while preparing a class on Signal Processing I've stumbled upon the new Spyder 3 on Anaconda and decided to see what it looks like.
几年来,我一直使用 Spyder 2 作为我的默认 Python IDE,在准备关于信号处理的课程时,我偶然发现了 Anaconda 上的新 Spyder 3,并决定看看它是什么样子。
First, I've updated the Anaconda distribution on my Ubuntu 16.04 office computer to the newest version (i.e. I had a previous version already installed), and then got quite surprised when the button for "Set Console Working Directory" on the File Explorer (top right, between the "folder" icon and the "up arrow" icon) was missing. I can still change the working directory manually on the IPython console, but it's impractical and certainly won't motivate the students!
首先,我已将 Ubuntu 16.04 办公计算机上的 Anaconda 发行版更新为最新版本(即我已经安装了以前的版本),然后当文件资源管理器上的“设置控制台工作目录”按钮时感到非常惊讶(右上角,“文件夹”图标和“向上箭头”图标之间)丢失。我仍然可以在 IPython 控制台上手动更改工作目录,但这是不切实际的,肯定不会激励学生!
Thinking it could be a bug with the conda update, I've then decided to give it a go at downloading and installing the Anaconda for Windows on my home laptop (which is probably what most of the students will do), and it also does not have the "Set Console Working Directory" button.
我认为这可能是 conda 更新的一个错误,然后我决定试一试,在我的家用笔记本电脑上下载和安装适用于 Windows 的 Anaconda(这可能是大多数学生会做的),而且它也确实如此没有“设置控制台工作目录”按钮。
By then I was thinking the new Spyder version might have abandoned it, but strangely enough, the Spyder GitHub pagehas a screenshot of the new Spyder 3 that HAS this exact same button (again: top right, between the "folder" icon and the "up arrow" icon)!
那时我在想新的 Spyder 版本可能已经放弃了它,但奇怪的是,Spyder GitHub 页面有一个新 Spyder 3 的屏幕截图,它有这个完全相同的按钮(再次:右上角,在“文件夹”图标和“向上箭头”图标)!
EDIT: here's a screenshot of how my Spyder looks like in Windows (the big red arrow is pointing towards where the icon should be):
编辑:这是我的 Spyder 在 Windows 中的样子的屏幕截图(大红色箭头指向图标的位置):
Does anyone knows if there is a setting option that hides the "Set console working directory" button, or if this is a bug in the more recent Anaconda version that doesn't show it?
有谁知道是否有隐藏“设置控制台工作目录”按钮的设置选项,或者这是否是较新的 Anaconda 版本中未显示的错误?
采纳答案by fabio_hirono
Answering my own question: I've contacted the Spyder developers, and this is "half a bug" :P (my choice of words).
回答我自己的问题:我已经联系了 Spyder 开发人员,这是“半个错误”:P(我选择的词)。
Let me explain:
让我解释:
The intended functionality for Spyder 3 is to automatically change the console working directory when navigating through the file explorer, therefore the lack of the old button is intentional and is not a bug;
However, this new functionality is not working at the moment, which is a bug :P
Spyder 3 的预期功能是在浏览文件资源管理器时自动更改控制台工作目录,因此旧按钮的缺失是有意的,不是错误;
但是,此新功能目前不起作用,这是一个错误:P
The good news is that this will be fixed for Spyder 3.0.2, which should be out in a few days :)
好消息是,这将在 Spyder 3.0.2 中修复,它应该会在几天内发布:)
(I've also been told that Anaconda usually takes a few days to add new versions in their repositories, so it might take a short while until we're able to update Spyder through conda
)
(我还被告知 Anaconda 通常需要几天时间才能在其存储库中添加新版本,因此可能需要一段时间才能通过 更新 Spyder conda
)
回答by shashi kant
I have been using Spyder 3.0 and faced the same issue. I was able to work-around it like this - go to the directory you want to make as working folder in the right side top option. Close and open up Spyder. It takes this as the working directory.
我一直在使用 Spyder 3.0 并面临同样的问题。我能够像这样解决它 - 在右侧顶部选项中转到要作为工作文件夹的目录。关闭并打开 Spyder。它将这个作为工作目录。
回答by Christopher Taylor
In the case where you're not having your directory change automatically, an alternative option is to manually locate the directory you want to go to and inside of the IPython Console just change to that directory directly.
如果您没有自动更改目录,另一种选择是手动定位您想要转到的目录,然后在 IPython 控制台内直接更改到该目录。
%cd 'Directory Location'
%cd '目录位置'
Just remember to do a sanity check and also run %pwd afterward.
请记住进行完整性检查,然后再运行 %pwd。