I have installed Centos7 and added python3.6 from epel-repository.subversion python-3.6.3 I am trying to check python 3.6 version via small script:
#!/usr/bin/env python36
import sys
print(sys.version)
The moment I run it in a IDE I am getting this :
2.7.5 (default, Apr 11 2018, 07:36:10) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
Why isn't it showing the python3 version?
You should indicate what ide you are using
Anyway, since you don't need to compile python, it is really easy to start your script from command line:
cd /script/folder
python3 myscript.py
if there is multiple python 3 installed, or a specific one, you can try this command:
python36 myscript.py
Sometimes you can use a virtualenv (actually it is strongly recommended) so you first need to create one:
python36 -m venv "name/and/path"
then you can call this virtual environment by tiping:
source /path/to/virtualenv/bin/activate
This previous command line can be used in a shell script if you need to automate things
your console should now indicate the name of your virtual environment:
(myvirtualenv) [user@host]$
from here you can install packages only on this environment
You should configure Geany to use python3.
From the Geany menu bar > Build > Set build command > Execute command
use the following command:
python3 "%f"
instead of:
python "%f"
On Atom , install script
:
apm install script
Your script should print the python 3.x
version.
#!/usr/bin/env python3
import sys
print(sys.version)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.