+ 1

How to install a new module for python in solo learn?

Recently, I ran a code and it said that no such module is present. This is the code: import qrcode img = qrcode.make("https://www.youtube.com/") img.save("youtubeQR.jpg") is the code wrong? if not tell me how do I install a new module so i can import it later in python?

19th Jul 2021, 10:28 AM
Harsha S
Harsha S - avatar
3 ответов
+ 4
you can add this to the top of your code. it will reinstall every time you run it. import os os.system("pip3 install qrcode")
19th Jul 2021, 10:51 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
import os os.system('pip install pygame') even this works
19th Jul 2021, 10:58 AM
Harsha S
Harsha S - avatar
+ 2
using os.system() you can execute many OS commands.
19th Jul 2021, 11:05 AM
Bahhaⵣ
Bahhaⵣ - avatar