问题
I'm having a problem getting my local variables autocompleted. This is a very basic functionality which I'm sure it should support. When I'm starting to write a variable name which was already declared, and press TAB (this is the default shortcut), I get nothing. Is this a bug?
回答1:
(Spyder dev here) Spyder does complete local variables but to have this functionality you need to install a library called rope
. You can do it by running this command in a terminal
pip install rope
If you use Python 3 this command needs to be
pip install rope_py3k
Besides, code completion on the Editor works now with both Ctrl+Space
and with Tab
.
Edit: Updated answer for the Spyder version 2.3.0.
回答2:
Another hint:
If you want to customize the shortcut (for example, your 'ctrl+space' is already occupied), try
Tools--Preferences--Keyboard shortcuts--code completion
you can change it to whatever you want
回答3:
Idoda, I made a little guide to install Python for scientific computing on Ubuntu or Debian from their repositories. I tested correctly using Python 3 on Ubuntu 14.04 LTS.
It summarizes as follows. First, install the interpreter and the package manager:
sudo apt-get install python3 python3-pip
Now install the Spyder's IDE:
sudo apt-get install spyder3
Thanks to Carlos Cordoba's advice, if you want to enjoy the autocomplete execute:
sudo pip3 install rope_py3k
Finally, open Spider and check if the autocomplete works rightly.
回答4:
In my case, with the command conda install spyder
, the installation process prompted me with the following...
The following NEW packages will be INSTALLED:
rope: 0.10.5-py36_0 conda-forge
spyder: 3.1.4-py36_0 conda-forge
Proceed ([y]/n)? y
I want to point out that my anaconda installation is for python 3. After this auto-completion was working. I'm utilizing OS X El Capitan.
回答5:
Usually, ctrl+space is set to code completion in Tools -> Preferences -> Keyboard shortcuts -> code completion We have the option to change it to another shortcut.
回答6:
I just reinstalled anaconda and auto completion working now.
Steps that I followed:
1> Uninstall Anaconda from control panel
2> Restart Computer
3> Download and install anconda from [here][1]
4> Restart again before it you start anaconda.
5> done.
Dependencies in spyder - 3.2.4 (python 3.6)
IPython >=4.0 : 6.1.0 (OK)
cython >=0.21 : 0.26.1 (OK)
jedi >=0.9.0 : 0.10.2 (OK)
nbconvert >=4.0 : 5.3.1 (OK)
numpy >=1.7 : 1.13.3 (OK)
pandas >=0.13.1 : 0.20.3 (OK)
pycodestyle >=2.3: 2.3.1 (OK)
pyflakes >=0.6.0 : 1.6.0 (OK)
pygments >=2.0 : 2.2.0 (OK)
pylint >=0.25 : 1.7.4 (OK)
qtconsole >=4.2.0: 4.3.1 (OK)
rope >=0.9.4 : 0.10.5 (OK)
sphinx >=0.6.6 : 1.6.3 (OK)
sympy >=0.7.3 : 1.1.1 (OK)
[1]: https://www.anaconda.com/download/#windows
来源:https://stackoverflow.com/questions/18044312/spyder-does-not-autocomplete-local-variables