pwntools Python module doesn't work in python2 but works in python3

16.1k Views Asked by At

I have a python2 script I want to run with the pwntools python module and I tried running it using:

python test.py

But then I get:

File "test.py", line 3, in from pwn import * ImportError: No module named pwn

But when I try it with python3, it gets past that error but it runs into other errors because it's a python2 script. Why does pwntools not work when I run it with python2 and can I get my script to run without porting the whole thing to python3?

2

There are 2 best solutions below

4
On BEST ANSWER

Hard to say for sure but it looks like you installed pwntools for python3 and not for python2. Packages are not shared between python versions. if you run python2 -m pip install --user pwntools and then try to run with python2 does it work?

0
On

Yeah even I had faced this issue. Try installing pwntools using sudo pip install pwntools.