OpenWRT: Menggunakan di mesin yang hanya ada python3

From OnnoWiki
Revision as of 11:13, 22 March 2022 by Onnowpurbo (talk | contribs) (Created page with "Tidak bisa pakai python3 harus buat virtualenv di python2 1 Since Python3 is not backward compatible you need to provide Python2 for installation. Follow this instructions...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Tidak bisa pakai python3 harus buat virtualenv di python2


1

Since Python3 is not backward compatible you need to provide Python2 for installation. Follow this instructions to create an isolated Python2 environment in your system:

Install Python2 (add repository if needed):

sudo apt install python2

Install pip (package manager):

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
sudo python2 get-pip.py

Install virtualenv:

sudo apt install virtualenv

Create virtual environment for Python2 in your favorite directory (change myenv to your favorite name):

virtualenv --python=python2 myenv

Activation:

source myenv/bin/activate

Deactivation:

deactivate

You can also install required python packages (if needed) by using pip in your activated environment.