[英]Open a function in Python Spyder, like I do with MATLAB
In MATLAB, there I can place the cursor on a function name and press Ctrl + D , the file containing the function will automatically open. 在MATLAB中,我可以将光标放在函数名称上并按Ctrl + D ,包含该函数的文件将自动打开。 Is there any way I can do something similar with Python, within the Spyder IDE? 在Spyder IDE中,有什么方法可以用Python做类似的事情吗?
In Spyder you can jump to the definition of a function (or class) by holding CTRL and clicking on the function (or class) name/reference. 在Spyder中,您可以通过按住CTRL并单击函数(或类)名称/引用来跳转到函数(或类)的定义。 If that definition is in an other file, that file will be opened. 如果该定义位于其他文件中,则将打开该文件。
Ctrl + Leftclick 按Ctrl +左键单击
EDIT as commented by @pwagner 编辑由@pwagner评论
Rightclick -> Goto Definition 右键单击 - >转到定义
and 和
Ctrl + G Ctrl + G.
also work 也工作
Altough the answer given above is correct, it didn't work for me. 尽管上面给出的答案是正确的,但它对我不起作用。 Here is what I ended up doing: 这是我最终做的事情:
With the help of this post , I figured out that my Ubuntu 14.04 was missing some python packages for spyder to work properly. 在这篇文章的帮助下,我发现我的Ubuntu 14.04缺少一些python包,以便spyder正常工作。
Go to Help -> Optional Dependencies
and check which of the packages are missing or not in the required version. 转到Help -> Optional Dependencies
并检查所需版本中缺少哪些软件包。 Copy to clipboard the list and paste it into an editor and store the file as requirements.txt
. 将列表复制到剪贴板并将其粘贴到编辑器中,并将文件存储为requirements.txt
。 Edit the file such that the list or required packages has the following format 编辑文件,使列表或所需的包具有以下格式
jedi==0.8.1
pep8==0.6
psutil==0.3
pyflakes==0.5.0
pylint==0.25
rope==0.9.2
sympy==0.7.3
Now do 现在做
sudo pip install -r requirements.txt
on that file. 在那个文件上。 Restart spyder. 重启spyder。 It should work now! 它现在应该工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.