0

When I run the command:

python checker.py capture.xml indication NULL

I get the error:

Traceback (most recent call last): File "checker.py", line 1, in ModuleNotFoundError: No module named 'bs4'

so I decided install bs4 in Python 24 but when I do:

pip install bs4

I get this message:

Requirement already satisfied: bs4 in c:\program files\python36\lib\site-packages Requirement already satisfied: beautifulsoup4 in c:\program files\python36\lib\site-packages (from bs4) You are using pip version 9.0.1, however version 18.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.

so indeed, the module is in that folder so I added c:\program files\python36\lib\ to the path environment variable just in case, but I'm getting the same thing.

Any idea on how to solve this, please?

1
  • 1
    So which version of python are you running? Python 2.4 or python 3.6? You have to add the executable to the path, then ensure the pip bootstrap is on. Then you should call the apropiate pip for the apropiate version.
    – dmb
    Commented Nov 20, 2018 at 12:56

1 Answer 1

0

It seems likely that your python command is referencing Python 2.4 (or some other installation of Python), while pip is referencing the version of pip installed with Python 3.6 in e.g. C:\Program Files\Python36. You can double-check the location of the python.exe called from the command line with where python.

Assuming the location returned by where python isn't e.g. C:\Program Files\Python36\python.exe, I would suggest checking both your User PATH and System Path environment variables. Make sure that e.g. C:\Program Files\Python36 is present and remove any similar references to alternate Python installations.

The other (non-destructive) option is to simply specify the full path to the python.exe you wish to use e.g.:

"C:\Program Files\Python36\python.exe" checker.py capture.xml indication NULL

Notes

  • Since you have Python 3.6 installed, you may have the Python Launcher for Windows installed as well. If this is the case, you can try replacing python with e.g. py -3.6 like so:

    py -3.6 checker.py capture.xml indication NULL
    
  • I have made some assumptions about capitalization in the paths above. Obviously, you should use whatever capitalization suits your installation.

  • While I don't believe this is relevant to answering your particular question, as a tip I would suggest installing Python into a directory without spaces (i.e. not C:\Program Files). This can help eliminate potential problems with file or folder paths in the future.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .