python-importpython-2.ximporterrorpwntoolspython-3.8

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


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?


Solution

  • 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?