简体   繁体   中英

ImportError; Issue installing Reportlab 3.4 with Python 3.5 in PyCharm

I am trying to run Reportlab 3.4 in Python 3.5 in PyCharm

I installed via Project Interpreter (and I also installed via Terminal). When I try to import the following packages

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.pagesizes import portrait
from reportlab.platypus import Image

I get the following error:

ImportError: No module named 'reportlab.pdfgen'; 'reportlab' is not a package

It seems that several people had this issue a few years back but I cannot find a recent example of this happening.

Any insight would be appreciated.

I had the same problem. The import statements worked if I typed them directly into the interpreter, but if I tried to execute my program from a file I got import errors stating: ImportError...'reportlab' is not a package. These import conflicts arise if you name your script reportlab.py, you just have to rename it to something else.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM