After building BCC from source and running the test "sudo /usr/share/bcc/tools/execsnoop", I got the following output:
Traceback (most recent call last): File "/usr/share/bcc/tools/execsnoop", line 21, in from bcc import BPF ImportError: No module named bcc
What does this mean and what can be done to remedy it?
After installing the dependencies, these are the steps that I followed:
git clone https://github.com/iovisor/bcc.git
mkdir bcc/build; cd bcc/build
# python2 can be substituted here, depending on your environment
cmake -DPYTHON_CMD=python3 ..
make && sudo make install
sudo /usr/share/bcc/tools/execsnoop #Test
this is caused due to python2 is set as default python.
$ ls -l `which python`
lrwxrwxrwx 1 root root 7 Mar  4  2019 /usr/bin/python -> python2
there is one way to change all occurrences of
#!/usr/bin/python to #!/usr/bin/python3
or
sudo ln -s /usr/bin/python3 /usr/bin/python
or
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 100
update-alternatives: using /usr/bin/python3.7 to provide /usr/bin/python (python) in auto mode
which will change python to alternatives python
$ ls -l `which python`
lrwxrwxrwx 1 root root 24 Nov 29 20:21 /usr/bin/python -> /etc/alternatives/python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With