Dec-27-2018, 10:01 AM
Hello everyone
I am writing to you from France. My english is really basic
I recently bought a Raspberry Pi 3 model B. I am under Rasbian version 9, updated today.
I installed python3 in addition to the original python2. A python3 command via the console confirms me a version 3.5.3.
In the various programs that I just wrote in python, I start with the shebang "#! / Usr / bin / env python3" which launches the use of version 3 of python.
I realized at launch of my programs that the syntaxes corresponding to python 3 generate errors.
For example, when I call tkinter with the syntax python 3 "import tkinter", I get the following error message "import tkinter ImportError: No module named tkinter"
When I use the python 2 syntax "import Tkinter", everything happens normally.
If in a program in python, after the shebang python 3, I run the command "sys.version_info [0]", I get the value 2 while I should have the value 3.
As a first approach, I would say that python 3 is as ignored, or not recognized by the system.
I looked in the directory / usr / bin and I found the different files related to python 3 and 3.5 (python3, python3-config, python3m, python3m-config, python3.5, python3.5-config, python3.5m, python3.5m-config).
Being still very new to this structure, I do not know which syntax to use for the Unix command to use. I did some tests with different syntaxes (eg #! / Usr / bin / env python3, #! / Usr / bin / env python3.5) plus the same with the prefix "env" (#! / Usr / bin / env python3, #! / usr / bin / env python3.5), but to no avail.
I told myself that tkinter was not installed on my RPI. I launched the command "sudo apt-get install python3-tk" but I have a message that tells me that tkinter is already installed!
Would anyone have advice to me to understand what is happening in order to effectively use python 3 on my RPI?
Many thanks to you
JP
I am writing to you from France. My english is really basic

I recently bought a Raspberry Pi 3 model B. I am under Rasbian version 9, updated today.
I installed python3 in addition to the original python2. A python3 command via the console confirms me a version 3.5.3.
In the various programs that I just wrote in python, I start with the shebang "#! / Usr / bin / env python3" which launches the use of version 3 of python.
I realized at launch of my programs that the syntaxes corresponding to python 3 generate errors.
For example, when I call tkinter with the syntax python 3 "import tkinter", I get the following error message "import tkinter ImportError: No module named tkinter"
When I use the python 2 syntax "import Tkinter", everything happens normally.
If in a program in python, after the shebang python 3, I run the command "sys.version_info [0]", I get the value 2 while I should have the value 3.
As a first approach, I would say that python 3 is as ignored, or not recognized by the system.
I looked in the directory / usr / bin and I found the different files related to python 3 and 3.5 (python3, python3-config, python3m, python3m-config, python3.5, python3.5-config, python3.5m, python3.5m-config).
Being still very new to this structure, I do not know which syntax to use for the Unix command to use. I did some tests with different syntaxes (eg #! / Usr / bin / env python3, #! / Usr / bin / env python3.5) plus the same with the prefix "env" (#! / Usr / bin / env python3, #! / usr / bin / env python3.5), but to no avail.
I told myself that tkinter was not installed on my RPI. I launched the command "sudo apt-get install python3-tk" but I have a message that tells me that tkinter is already installed!
Would anyone have advice to me to understand what is happening in order to effectively use python 3 on my RPI?
Many thanks to you
JP