python-escpos: ImportError: No module named escpos.printer on Windows 10
I have:
- searched open and closed issues for duplicates
Bug description
I am getting the error ImportError: No module named escpos.printer
when trying to run code that was working fine previously. I do not know what has changed, but it no longer works!
Steps to reproduce
- Installed with
pip install python-escpos[all]
, which completed successfully - Tried to run the following code, which was working previously:
#!/usr/bin/env python
from escpos.printer import Usb
p = Usb(0x0416, 0xaabb)
p.qr("https://matiasw.etsy.com", size=8)
p.text("https://matiasw.etsy.com\n")
p.cut()
- Got the above-mentioned error
Device info
Printer: XPrinter XP-58IIH
python-escpos version: This command retuns:
'python-escpos' is not recognized as an internal or external command,
operable program or batch file.
This leads me to think that the installation is seriously borked somehow, but I don’t know how, nor how to fix it!
python version: 3.9.13
operating system: Windows 10 Version 22H2
About this issue
- Original URL
- State: closed
- Created 8 months ago
- Comments: 19 (9 by maintainers)
Each python version has its own sites-packages folder so you can’t import a library that was installed with a different python version.
Well, virtual environments are a good solution. I use pyenv for simplicity and power. In addition to managing the virtual environment automatically by folder, it allows you to install the version of python you want on your system. Also, it integrates very well with the most popular IDEs. There are plenty of pyenv tutorials out there that will provide you with the information you need to use it.