Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pycharm and Windoze
#1
I don't use Windows normally, but I can't buy a laptop here without Windows, so I have Windows 10.

I wanted to see what Pycharm is like, so I installed it in Windows

I copied some Python files onto a usb-stick and tried to run them in Pycharm.

First Pycharm said: no module openpyxl.

I installed openpyxl using pip in cmd.

Pycharm still said: no module openpyxl.

I installed Python from python.org

After that, Pycharm found openpyxl, but then it balked at:

Quote:from openpyxl.styles import PatternFill

Pycharm says: no module openpyxl.styles

I ran Idle IDE in Windows, and I can use:

Quote:from openpyxl.styles import PatternFill

No problem

What do I have to do, apart from installing openpyxl, to get PatternFill (and other .syles functions) in Windoze?
Reply
#2
see: https://openpyxl.readthedocs.io/en/stable/styles.html
Reply
#3
Thanks for your reply!

I couldn't find any specific reference to Pycharm there. The docs page has, as the first example:

from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font
Which indicates, that is the way to do it.

Pycharm automatically creates a VENV for a project.

It accepts

import openpyxl 
and

from pathlib import Path
then stops at

from openpyxl.styles import PatternFill
whereas Idle IDE has no problem with getting styles from openpyxl.styles

A Windoze mystery!
Reply
#4
sorry, I used to use pycharm, and recall that it wants you to install through their interface.
likely the version of python being used by pycharm and the one available from cmd are different versions which would explain why it can't see openpyxl.
from cmd, you can (Not a windows guy, but assume it's the same) use pip -V to get pip version,
and python -V to get python version, then compare with the pycharm version and see if they are the same.
each version of python (usually) comes with it's own version of pip.
There are exceptions, for example Anaconda uses 'conda'
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020