I am pulling what is left of my hair out, exasperated and have run out of ideas, and I am hoping someone can assist! So, I originally installed python 310 and PyCharm, and some packages like xlwings and everything was working fine. The pip command was recognized and functioned when I use it to try and install a package, and xlwings worked okay when imported and ran in a script. Then I tried to install pandas but was failing to install because numpy wheel could not be built (that was the error I was getting) and in my quest to resolve this, installed Microsoft Visual Studio C++ building tools (one of the suggested solutions I found) and this resolved the issue and numpy and pandas were installed. However, I started having some performance issue with my PC (running windows 8.1) and the only way I could resolve it (well I think as the performance issue I was having has not recurred) was to system restore my PC back to the state it was before installing the MVS building tools. Since then, I have been having the following two issues:
(1) I get the error message “ ‘pip’ is not recognized as an internal or external command , operable program or batch file.” Anytime I run the pip command in command prompt or terminal.
I have python 310 with pip 21.3, pywin32 and pypiwin32 installed. One of the solutions I found suggested was to set the correct path where python scripts folder is but this did not resolve the issue.
(2) When I run xlwings, for example a simple script below just to open a work group:
import xlwings as xw
wb = xw.Book("StockScreener.xlsm")
I get the following error:
Traceback (most recent call last):
File "C:\Users\Username\Desktop\Python files\OpenExcelWB.py", line 1, in <module>
import xlwings as xw
File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlwings\__init__.py", line 9, in <module>
from . import _xlwindows as xlplatform
File "C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\xlwings\_xlwindows.py", line 14, in <module>
import pywintypes
ModuleNotFoundError: No module named 'pywintypes'
Process finished with exit code 1
I have searched and searched for a solution for this and all I see are suggestions to install pywin32, pypiwin2, win32 which are all already installed. There is this other suggestion about copying the files pythoncom38.dll
and pywintypes38.dll
from C:\Users\"Your user id"\AppData\Roaming\Python\Python38\site-packages\pywin32_system32
to C:\Users\"Your user id"\AppData\Roaming\Python\Python38\site-packages\win32\lib
and C:\Users\"Your user id"\AppData\Roaming\Python\Python38\site-packages\win32
By the way, I am aware my python is 310, so I looked for python 310 not python38, but I could not find these pythoncom38.dll
and pywintypes38.dll
files (which in my case I am assuming will be something like pythoncom310.dll and pywintypes310.dll) anywhere! And my C:\Users\Username\AppData\Roaming\Python
had not a single file or folder in it (i.e. was empty).
I have also uninstalled python and Pycharm and re-installed them afresh but still getting the same issues.