Python autocompletion/autosuggestion on GNU/Linux - python

Assume you imported a package, say unittest2
if you were using Windows IDLE, if you press:
unittest2.
a small help window will pop up and show the list of functions you can use, similarly how can I get this small pop up on linux ?
Am accessing a linux box from putty

If you want to use IDE, then Pycharm should be what you are looking for . Please refer to download and install it.
If you are using Vim editor, then python-mode plugin will do all this jobs for you. Please see this picture:
.

Here is a few of many editors you might use in the Linux:
For python IDE:
PyCharm: https://www.jetbrains.com/pycharm/help/auto-completing-code.html
For generic editors:
vi/vim: http://vim.wikia.com/wiki/Any_word_completion
emacs: http://emacswiki.org/emacs/AutoComplete
BTW, if in the Python interpreter:
http://conjurecode.com/enable-auto-complete-in-python-interpreter/

Related

How do I set up Python 3 with IntelliJ IDEA on OSX?

I'm highly confused about this. Python3 is installed per default on the MacBook.
which python3 will output /Library/Frameworks/Python.framework/Versions/3.6/bin/python3
Great, so that's my SDK to put into IntelliJ IDEA, one should think.
I have the Python plugin for IDEA. However, I can't run Python files. So I try to change the configuration and set it to the above PATH for the Python interpreter.
However, still nothing. Trying to run the Python file inside IDEA will prompt a new configuration?
I can run the script just file doing python3 script.py in the terminal? I know the path for the Python3 library, yet, IDEA doesn't recognise it at all and doesn't save the configuration.
What am I doing wrong in this process? This should be fairly easy to set up but turns out it isn't :)
I even tried to create a Python 3.6.2 virtual environment with the IDEA internal tool - same thing? It doesn't allow me to run the Python3 script from inside IDEA.
Should I use python from usr/bin/python? If I cd there, I can see Python3. But inside IDEA, i only have access to Python2..
After installing Python 3.8.1 via pyenv which I now recommend over using Homebrew (see https://github.com/pyenv/pyenv), I did the following to add this version to IntelliJ IDEA.
Close all open projects. This will display the Welcome to IntelliJ IDEA window listing recent projects along the left.
Click on Configure -> Structure for New Projects
Click on SDKs under Platform Settings along the left
Click on the + sign above the SDK list and select Python SDK
From the Add Python Interpreter window, select System Interpreter
Click on the ... button to the right of the Interpreter drop down and browse to $HOME/.pyenv/versions/3.8.1/bin/python. Replace 3.8.1 with the desired Python version if you want to configure another version.
Updated for IntelliJ IDEA 2019.3.3
Try this in menu of IDEA: File -> Settings -> Project: Name of project -> Project Interpreter and from above in the window you can choice interpreter version or virtualenv.

Is it possible to get code editors in virtualenv?

I recently downloaded virtualenv on my MacOSX Sierra (10.12.2). I'm not very experienced with virtualenv and I've been coding using the interactive interpreter in terminal and I was wondering if there was an alternate way that I could use an editor(IDLE, Sublime, etc.) and still use it in virtualenv. Would I just install an editor into virtualenv or am I limited to only the interactive shell?
You are not limited to only interactive shell. For your coding part you can download and install sublime text and open your project (any project irrespective of the language you use) and get started. Here is a quick guide for getting started in sublime text : sublime text getting started
You might also want to take a look at this post: SublimeREPL plugin
You can use atom editor, inside that you can use virtualenv plugin

python support in gvim but not console vim

Windows 7 -
I'm a fairly new Windows person and am trying to get a nice setup with Vim, Ultisnips, and more in the console. To get Ultisnips working, it appears I need python support in Vim. I have installed Python 2.7.9 (and other later versions) and reinstalled Vim74 multiple times, but python shows as -python, -python3 in vim's version report.
Now GVim does show python support, but running vim from git bash does not. See screenshot.
In GVim, when I do :python import sys; print(sys.version), it shows
2.7.9 (default, Dec 10... etc) Is it reflecting the preferred Python it needs, or just what I have installed?
I would love to use vim in the console/terminal with Ultisnips.
Do I have to install Vim in a special way? Or set something in _vimrc? The console vim also doesn't display :help either (gvim is fine), but that's another issue (related?)
I have spent a good chunk of time looking at relevant articles, but can't get it to work. Thanks for any advice!
python config screenshot
Try to put settings in .gvimrc/_gvimrc beside the .vimrc/_vimrc file.
For the help about gvimrc type :h gvimrc when in command mode in vim.
If the gvimrc files exist, they are used to configure Vim when the GUI version (gvim) runs (after settings from vimrc are applied).
Settings for gvim can also be placed in the vimrc file using a has('gui_running') check:
if has('gui_running')
set guioptions-=T " no toolbar
colorscheme elflord
endif
The console vim command was apparently running a copy of vim in the Git directory, where it seems to be missing a bunch of things including /doc, hence the 'help' not working. I can now run vim in the program files directory via console, where it now shows python support, and help etc.

Configuring python interpretor with pycharm

Whenever I am configuring python interpreter, on compiling a pop-up is popping up to edit, modify, or uninstall python ,below is the screenshot
The Auto Config feature of the IDE looks for it in the PATH set by the user.
Better way to do it is add it in your system variables from where the IDE could pick it up.
For Mac its under the Library\Frameworks\Python.framework\Versions\X.Y\bin\
For Windows its mostly under C:\PythonXY\python.exe
& For more 'what ifs' you can find it documented here.

How can I run a python program in Komodo IDE like in IDLE(Python GUI) using Run Module feature?

Sorry I am a Python beginner and after several months with Python(GUI) I now want to move to Komodo IDE 8.5 (Suggested by posts on this forum), but I had trouble on configuring it to proper use. The main issue is how I can run a Python program in Komodo like in IDLE(Python GUI) using Run Module (pressing F5) feature?
When I pressed F5 in Komodo IDE 8.5, I got message "No Python interpreter is available".
I am using Python 3.30. Python.exe is in this path "D:\1_tools\python". Komodo.exe is in this path "D:\1_tools\komodo_IDE"
Thanks for any kind helpers. I have searched the forum but did not get any helpful info. Thanks again.
There is a thread on the Komodo Community Site that discusses this exact situation. (http://community.activestate.com/node/10113)
Sumarizing:
It seems that Komodo IDE defaults to using Python2 and since it can't find a Python2 interpreter, it complains.
Solution:
For existing files, the suggested solution is to tell Komodo IDE (via "Properties and Settings" on the Editor Tab) that the file uses the Python 3 interpreter.
If you create all new python source files using the Python3 template, the IDE will be able to run them. Beware: The first time you want to use the Python3 template you will have to create the new file using the menu: "File" -> "New" -> "File from Template", then select the Python 3 template.
Is Python on your PATH? That is, if you open a command prompt and type python by itself, does it run? In Komodo, look under Edit/Preferences/Languages/Python3 and check the configuration. If python.exe is not on your PATH you can provide the full path to it there

Categories

Resources