how can I install win32con? - python

I'm trying to use winshell to generate a url shortcut file,
so I did:
pip installed winshell
However on line 30 of the winshell.py file it requires the module win32con : my understanding is that win32con is apart of pywin32, which is already installed.
The specific error I get when trying to import win32con is:
(base) C:\Users\deana>pip install win32con
ERROR: Could not find a version that satisfies the requirement win32con (from versions: none)
ERROR: No matching distribution found for win32con
I've found a few references online and on stack exchange but nothing.
running windows 11.

pip install pywin32
Happy to help.

Related

Library installed but can't be imported

I have already installed "PySimpleGUI" library, but I can't import it. In my terminal window I typed:
pip install PySimpleGUI
And it worked, because I typed it again and received this message:
PS C:\Users\raulc\AMBIENTES> pip install PySimpleGUI
Requirement already satisfied: PySimpleGUI in c:\users\raulc\appdata\local\programs\python\python310\lib\site-packages (4.59.0)
However, I can't import it, that's what i get:
Import "PySimpleGUI" could not be resolved

Why I can't use tkinter

I use Ubuntu. When I try to install tkinter it throws error
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter
I saw that this error is beacuse I already have tkinter, but when I try to import it there is another error
ModuleNotFoundError: No module named 'tkinter'
This happens also when I use capital T (Tkinter).
For installing tkinter in Ubuntu I use the command:
sudo apt install python3-tk

ImportError: No module named win32api Error

When trying to import win32api, win32con modules for my code, I have been getting the following error:
Traceback (most recent call last):
File "C:\Users\Henil\Desktop\LinkedIn-Easy-Apply-Automation-master\LinkedInEasyApply.py", line 16, in <module>
import win32api, win32con
ImportError: No module named win32api
So I ran pip install pypiwin32 and the installation went through. But when running the code I get the same "No Module Found".
So I tried pip install -U pypiwin32 and I get the following output:
pip install -U pypiwin32
Requirement already up-to-date: pypiwin32 in c:\python27\lib\site-packages
Requirement already up-to-date: pywin32>=223 in c:\python27\lib\site-packages (from pypiwin32)
However, when I run the program I still get "No module found" error. Do I need to change paths somehow?
I am on Windows 10 64 bit machine.
In my case, i'm importing this modules:
import win32com.client as win32
from win32com.client import Dispatch
win32c = win32.constants
I'm using win32 to open Excel files:
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open(xlsx_file)
wb.Save()
excel.Application.Quit()

How to install the os module?

I'm trying to install the os Python module on Windows.
In a cmd console, I typed:
C:\Users\username> pip install os
Collecting os
Could not find a version that satisfies the requirement os (from versions: )
No matching distribution found for os
So I guessed the module was not available on Windows for some reasons, but I found references of it in some SO questions.
Obviously, typing Windows and os in Google only gives me answers about Windows itself.
So, how can I install the os module on Windows?
See Also:
Determining if a given Python module is a built-in module - to learn how to check if a library is built-in and hence doesn't require installing.
OS is python's standard library. So no need to download it.

No module named openpyxl - Python 3.6 - OSX

I've installed openpyxl from the Terminal using
pip3 install openpyxl
without any problems. I've even double-checked by simply running import openpyxl from the Terminal window once Python is running, and it imports no problem.
The problem starts when I try and import openpyxl from a script I'm building to work with a spreadsheet. I'm using Sublime Text and can't even get past the import openpyxl at the beginning of the script without running into the following error:
Traceback (most recent call last):
File "/Users/wcw/Desktop/test.py", line 1, in
import openpyxl
ImportError: No module named openpyxl
How can this be happening? I know I've installed openpyxl correctly from the Terminal window without any errors so how can my script not find the module?
Try to do:
pip3 install --user openpyxl
Doing the --user worked for me when I tried to run my .py files with matplot lib modules which worked in 3.5 but not in 3.6.
I have the same problem.
I've installed the openpyxl succesfully via Anaconda
!pip3 install --upgrade openpyxl
Collecting openpyxl Using cached
https://files.pythonhosted.org/packages/95/8c/83563c60489954e5b80f9e2596b93a68e1ac4e4a730deb1aae632066d704/openpyxl-3.0.3.tar.gz
Requirement already satisfied, skipping upgrade: jdcal in
/Users/a18301335/Library/Python/3.8/lib/python/site-packages (from
openpyxl) (1.4.1) Requirement already satisfied, skipping upgrade:
et_xmlfile in
/Users/a18301335/Library/Python/3.8/lib/python/site-packages (from
openpyxl) (1.0.1) Installing collected packages: openpyxl Found
existing installation: openpyxl 1.8.6
Uninstalling openpyxl-1.8.6:
Successfully uninstalled openpyxl-1.8.6 Running setup.py install for openpyxl ... done Successfully installed openpyxl-3.0.3
But when I try to use tat library I get an error No module named openpyxl
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
If I try to import openpyxl in Terminal, I don't have the error. What's wrong?
This may be overly simplistic, but I had the same problem. I installed the module successfully but import openpyxl resulted in an error. I needed to close IDLE and start a new session. After that, my import command worked just fine.

Categories