I am having issues when importing scapy in my Ubuntu virtual machine.
I can easily use from scapy.all import *
in the terminal.
I am using Visual Studio Code and when I hover over scapy, right click and go to defintion, it takes me to the scapy file.
Here's what solutions I've seen and tried:
My filename(or any filename in the folder) is not "scapy.py".
I've installed scapy directly from the website, used "sudo apt-get install python3-scapy" and also tried with "pip install scapy". None of which changed anything.
If I run another python file (without "sudo" and with "from scapy.all import *") it runs fine. But there is an import issue when I use "sudo".
I tried to do the following to solve my issue:
- Type in the terminal:
sudo mkdir /usr/lib/python2.7/dist-packages/scapy
cd /usr/lib/python3/dist-packages/
cp -avr scapy/* /usr/lib/python2.7/dist-packages/scapy
\
This also didnt work out.
- Type in the terminal:
I also thought maybe I messed up some of the module files. So I tried doing everything on a new VirtualBox image. But that also failed.
I can type "scapy" in the terminal and it opens up fine.
my python version is 3.8.10
Scapy version: 2.4.5
I've been stuck on this for 4 days. Please help.