OpenWRT: Menggunakan di mesin yang hanya ada python3

From OnnoWiki
Jump to navigation Jump to search

Tidak bisa pakai python3 harus buat virtualenv di python2


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.