6

I have already installed qrcode library in my command prompt and also updated my command prompt. In the command prompt it says that everything is fine but when I go to PyCharm and type in:

import qrcode

img = qrcode.make("This is the qrcode")
img.save("myqrcode.png")

And when I run it, it says:

Traceback (most recent call last):
  File "C:\Users\Antho\PycharmProjects\pythonProject\main.py", line 1, in <module>
    import qrcode
ModuleNotFoundError: No module named 'qrcode'
astrochun
  • 1,642
  • 2
  • 7
  • 18
Xotiic
  • 61
  • 1
  • 1
  • 4

4 Answers4

5

Install the qrcode with admin rights

sudo pip install qrcode 

or

sudo pip3 install qrcode
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
Anandh G
  • 51
  • 1
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Ethan Jun 10 '22 at 01:20
  • When using Windows Debian, I found that I needed to restart the app for the install to take effect. – Anthony Petrillo Aug 16 '22 at 19:28
1

use pip install qrcode this will install the required dependency.

manav014
  • 68
  • 1
0

For those (using Pycharm) having problem with "import qrcode" "ModuleNotFoundError: No module named 'qrcode'". After "pip install qrcode" at command prompt, you also need to install "package" name qrcode in Pycharm too. File -> Settings -> Project:#### -> Python Interpreter -> "+" -> search "qrcode" -> Press "Install Package"

0

run with python command only

python filename.py
vatsal mangukiya
  • 261
  • 2
  • 14
  • 1
    I don't think this would necessarily solve the issue posed by the questioner, if you add a little more information around how/why this answer does solve their issue, it might be more useful. – Thomas Kimber Mar 27 '23 at 09:10