Wednesday, June 6, 2012
How to get geany to use python3 as its default
How to get Geany to use Python 3 by as the python version default
Step 1.)
After installing geany you want to go into the terminal and enter this:
"sudo <text editor here> /usr/share/geany/filetypes.python"
Doing so will ask for your password and subsequently bring you to a text file for geany's python settings
Step 2.)
Go to the bottom of the file and comment out the bottom two lines (Just add a # infront of them)
Step 3.)
Now copy paste the following two lines into the bottom of the doccument:
compiler=python3 -c "import py_compile; py_compile.compile('%f')"
run_cmd=python3 "%f"
Step 4.)
After you save it the next time you open your python script in Geany you will be able to run (f5)
and use it as python3 (Assuming that is what you code in)
Cheers!
Labels:
Geany,
Linux,
Open Source,
Python,
Quick Tips
Subscribe to:
Post Comments (Atom)
Thank you
ReplyDeleteThank you.
ReplyDeletethank you!
ReplyDeleteBeautifully written and helpful article!
ReplyDeleteExactly what I was looking for. Thanks.
ReplyDeletehit the bull's eye
ReplyDeletethank you
Thank you!
ReplyDeleteThank you very much!
ReplyDeletethanks so much :)
ReplyDeleteyou can also copy /usr/share/geany/filetypes.python into your home directory
ReplyDelete~/.config/geany/filedefs and edit it there. You only need the few settings you are changing, all others will be read from the system wide file.
Thank you! I was wondering why my old code of Python 3 did not work.
ReplyDeleteThank you!
ReplyDeleteWorks great, thank you! Too bad that Geany does not have a better 'preferences' section for changing these types of things. Is there any way to get Geany to run BOTH Python2 and Python3?
ReplyDeleteThank you!
ReplyDeleteGreat. Your instructions worked.
ReplyDeleteI'm afraid if you are running Geany under Ubuntu 16.04 you'll find the filetypes file has changed a bit. At the bottom you find the build menu, I modified mine to
ReplyDelete[build-menu]
# %f will be replaced by the complete filename
# %e will be replaced by the filename without extension
# (use only one of it at one time)
FT_00_LB=_Compile
FT_00_CM=python3 -m py_compile "%f"
FT_00_WD=
FT_02_LB=_Lint
FT_02_CM=pep8 --max-line-length=80 "%f"
FT_02_WD=
error_regex=(.+):([0-9]+):([0-9]+)
EX_00_LB=_Execute
EX_00_CM=python3 "%f"
EX_00_WD=
which is now working well for Python 3
Thanks so much!
ReplyDelete