2
votes

I wrote a web scraping programming a couple of months ago, which I had python -m venv venv did a bunch of pip install, checked and doubled check with pip list, everything looks fine.

And today I wanna scrape again so I did my source venv/bin/activate checked with pip list, everything looks fine, and just keep having no module of this and that...

But when I deactivated it, it falls back to my global installed modules, my program runs perfectly fine. I could't believe it so i did : rm -rf venv and python -m venv source venv/bin/activate pip install -r requirements.txt everything installed, check with pip list, and no module of this or that.

Anyone, please tell me what's happening? thank you!

1
check your python path which python - neilharia7
python3.8, i made sure I am not using 2.X, and venv is recommended by python 3.8 doc, that's why i stick with it - Mr.Ko

1 Answers

1
votes

To ensure what python is being used and which python is linked to current pip:

  • which python to see where is the python executable (alternatively which python3, which python3.7, etc...)
  • running python show the version of python
  • pip -V shows the python to which it is linked
  • use python -m pip list to ensure the pip is linked to the python
  • python -m site shows were is the site-package located
  • writing python and hitting TAB multiple times shows what pythons are available in the path (os dependent)

This is more of a way to debug which python is being used.