Iklan1

Saturday, July 27, 2019

TIPS : Switch Python Version On Ubuntu 16.04

Assalamualaykum,
Cara menukar versi python yang akan digunakan pada Linux Ubuntu 16.04.

Berikut langkahnya:

1. Penggunaan linux default-nya
pcname@pcname:~$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
KeyboardInterrupt
>>>
[1]+  Stopped                 python

2. lihat versi python yang terinstall
pcname@pcname:~$ ls /usr/bin/python*
/usr/bin/python   /usr/bin/python2.7  /usr/bin/python3.5   /usr/bin/python3m
/usr/bin/python2  /usr/bin/python3    /usr/bin/python3.5m

3. eksekusi koman
pcname@pcname:~$ sudo nano ~/.bashrc

4. Setelah muncul file bashrc tambahkan rule
alias python='/usr/bin/python3.5'

5. eksekusi . ~/.bashrc
pcname@pcname:~$ . ~/.bashrc

6. cek versi python terbaru
pcname@pcname:~$ python --version
Python 3.5.2

pcname@pcname:~$ python
Python 3.5.2 (default, Nov 12 2018, 13:43:14)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
[2]+  Stopped                 /usr/bin/python3.5

Demikian, Semoga bermanfaat
Wassalamulaykum

No comments:

Post a Comment