1

After I made a new virtual environment in python python3 -m venv venv, I did pip install gtts and by doing pip freeze I can verify that it was successfully installed. Also, I did activate the virtual environment before installing. On the pip freeze, the only thing that showed up is gtts, six, certifi, and other packages used by gtts.

Sometime later, after closing my cmd, I started the virtual environment again via cd venv/Scripts then activate.bat, and when I pip freez-ed it shows the libraries I have installed on the main system. I can say that because Pillow, pynput, pygame, etc. is there and gtts is not.

I tried reactivating it, and the same thing happened. When I pip freeze-ed on the main system, it works perfectly, and still no gtts can be found, meaning I didn't mix the two up. When I clicked the python.exe on the venv, and did import gtts, no error showed up, meaning that gtts did get installed on the venv.

double-beep
  • 5,031
  • 17
  • 33
  • 41

1 Answers1

0

When you did python3 -m venv venv it just created the virtual environment but you have to activate it by yourself, since you didn't activate it in the first time it installed gtts to the main python interpreter on your system, in the second time when you activated the venv you didn't see gtts there since it was installed onto the main interpreter.

Jonathan1609
  • 1,809
  • 1
  • 5
  • 22
  • ohh, sorry, I did activate the venv before I pip installed, sorry for the confusion – Tasukete Onegaishimasu Jul 01 '21 at 08:00
  • @TasuketeOnegaishimasu "After I made a new virtual environment in python python3 -m venv venv, I did pip install gtts and by doing pip freeze I can verify that it was successfully installed.", did you activate it in that step? – Jonathan1609 Jul 01 '21 at 08:01
  • I did, I can still remember the pip freeze only showing a few number of libraries. Namely, six, certifi, gtts, and others. Pygame, pynput, and other libraries that I usually use in the main interpreter wasn't there, so I did manage to get inside the venv. – Tasukete Onegaishimasu Jul 01 '21 at 08:05