I'm new to python.
I'm working in windows environment. mostly win7.
My machine is win7 32bit also.
I downloaded the wmi module and used the .exe to install it.
when I try and 'import wmi', i get an error:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
import wmi
File "C:\Python33\lib\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
ImportError: No module named 'win32com'
How can I solve this? Does win7 compliant with this module?
Regards
download WMI-1.4.9.win32.exe from https://pypi.python.org/pypi/WMI/ and it will resolve your problem
Instead you can also install win32com which would resolve the issue.
To install win32com use:
pip install pypiwin32
What worked for me is:
i downloaded the source named: WMI-1.4.9.zip from https://pypi.python.org/pypi/WMI/
Extracted all files from that zip file and saved it in a folder named: WMI-1.4.9 and then copied that folder to C:\Python27\Lib\site-packages.
After that I navigated to that folder C:\Python27\Lib\site-packages\WMI-1.4.9 and did a shift + right click -> Open Command line here and ran: python setup.py install
That's it, after that it worked for me like charm. No issues.
p.s - While installing exe I had some weird Access Denied errors, I tried by running the exe as Administrator even then I could get through it. Hence that didn't at all work for me.
Also I had pywin32 installed from here:
http://sourceforge.net/projects/pywin32/files/ (select the correct file - 'bittedness' and python version wise)
Related
I'm trying to run a Python script from the Windows shell, but when I do
python path\to\file\script.py
I get an error "DLL load failed: The specified module could not be found" and it traces back to the line where I import numpy.
C:\Users\Admin>python path\to\file\script.py
Traceback (most recent call last):
File "path\to\file\script.py", line 8, in <module>
import numpy as np
File "C:\Users\Admin\Anaconda3\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\Admin\Anaconda3\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
The weird part is that when I run it in an editor like Spyder, numpy imports just fine. Can someone help me?
Thanks
It's fixed Anaconda path issue. Check your %PATH% if it's correctly defined.
Source: https://github.com/numpy/numpy/issues/12957
This is a common problem when installing python packages, mainly in windows.
Numpy and other packages have bindings to C++ code that require some special dependencies.
Rather than trying to get the dependencies exactly right for compiling the package, you can use a precompiled "wheel" file from one of several sources.
I use Chris Gholke's site
download the .whl file and install using
pip install directory/path/package.whl
edit: and as a note, the python environment you access from powershell or cmd is different from the anaconda environment in spyder. One of the differences between conda and pip is that conda installed precompiled packages while pip does not.
I solved my issues with Numpy DLL load issues by replacing Anaconda3 with WinPython.
I have installed Python 3.4 and wxPython Phoenix on Windows 10. I go into Eclipse and add wxPython to the external libs in my project, but when I try to import it, I get this error:
Traceback (most recent call last):
File "C:\Users\linus\workspace\MiCS 1.2\main.py", line 1, in <module>
import wx
File "C:\Python34\Lib\site-packages\wx\__init__.py", line 17, in <module>
from wx.core import *
File "C:\Python34\Lib\site-packages\wx\core.py", line 6, in <module>
from ._core import *
ImportError: DLL load failed: The specified module could not be found.
I did some searching and tinkering and still can't figure out what's causing it. It shouldn't be the msvcp or msvcr DLLs as I have Office running just fine (or is that an incorrect assumption?) Any help is appreciated. Thanks.
How did you install wxpython?
As of now, the top page of the official site has wxpython 3.0 only for python27. So, I suspect you might not have installed it properly.
If you have your python34 at C:/Python34 then, cd to C:/Python34/Scripts first so that we make sure to use the pip for this python.
According to this post (https://groups.google.com/forum/#!topic/wxpython-dev/LmGIrQyh7jc), try
pip install -U --pre -f http://wxpython.org/Phoenix/snapshot-builds/ wxPython_Phoenix
This should find the corresponding whl file for your python version and CPU architecture.
Or, you could manually download whl file at http://wxpython.org/Phoenix/snapshot-builds/
If you have 32 bit Python34, then look for ******-cp34-none-win32.whl
and simply do:
pip install path/to/the/whl/that/you/just/downloaded/wxPython_Phoenix-3.0.3.dev1839+4ecd949-cp34-none-win32.whl
After this, if you can import wx in the normal cmd then the problem should be coming from eclipse.
I installed wmi with the installer here http://timgolden.me.uk/python/wmi/index.html
but I can't get the module to import.
Here is my code:
import wmi
c=wmi.WMI()
for os in c.Win32_OperatingSystem():
print(os.Caption)
and here is the error:
Traceback (most recent call last):
File "C:/Python33/Programs/WMI trial.py", line 1, in <module>
import wmi
File "C:\Python33\lib\site-packages\wmi.py", line 88, in <module>
from win32com.client import GetObject, Dispatch
ImportError: No module named 'win32com'
Any idea why this isn't working? I have a 64 bit system but that hasn't affected running 32 bit python at all.
Any help is greatly appreciated!
you are missing the 'Python For Windows Extensions' (pywin32).
WMI module requires pywin32.
run the appropriate installer for pywin32, then try WMI again.
The "No module named 'win32com'" error is because it can't find the winm32com module (which is installed as part of pywin32 package.)
What worked for me is:
i downloaded the source named: WMI-1.4.9.zip from https://pypi.python.org/pypi/WMI/
Extracted all files from that zip file and saved it in a folder named: WMI-1.4.9 and then copied that folder to C:\Python27\Lib\site-packages.
After that I navigated to that folder C:\Python27\Lib\site-packages\WMI-1.4.9 and did a shift + right click -> Open Command line here and ran: python setup.py install
That's it, after that it worked for me like charm. No issues.
p.s - While installing exe I had some weird Access Denied errors, I tried by running the exe as Administrator even then I could get through it. Hence that didn't at all work for me.
Edit:
Also I had pywin32 installed from here:
http://sourceforge.net/projects/pywin32/files/ (select the correct file - 'bittedness' and python version wise)
I'm trying to add win32com to Python 2.7. After looking at this, I added the directory with the _init file (Python27\Lib\site-packages\win32com) but I still get it. I went so far as to try to add a bunch of different folders to the path that seem to have to deal with win32com but I still get the error. If it knows where the file is and I added that folder to PYTHONPATH, why is this happening? I'm using PyDev with Eclipse Juno. My code:
import win32com.client
print("hello world")
when I try to run this, i get this error
Traceback (most recent call last):
File "C:\Users\Daniel\EclipseWorkspace\PhotoScript\src\scriptLaunch.py", line 1, in <module>
import win32com.client
File "C:\Python27\Lib\site-packages\win32com\__init__.py", line 5, in <module>
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.
in my case typing in cmd:
python C:\Python27\Scripts\pywin32_postinstall.py -install
cmd Windows
I hope this helps
Try installing ActivePython, it includes win32com:
The Python for Windows Extensions (PyWin32 version 214).
The interface to the Win32 API (win32api).
The interfaces to Win32 COM (win32com and win32comext).
The Pythonwin Development Environment.
*ActivePython is fully binary compatible with python.org Python builds to ensure that 3rd-party binary extensions just work*
Try to install python for windows extensions:
https://sourceforge.net/projects/pywin32/files/pywin32/Build%20210/
Goal: Trying to use VTK library in Python Interpreter.
What I did: I have installed VTK using CMake with option VTK_WRAP_PYTHON and Shared_Library enabled and build the VTK in visual studio and it has finished with all builds successfully.
Then I made the Python_Path.
Problem: When I try to import vtk library into python, I get the following error message:
>>> import vtk
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import vtk
File "...\VTK\VTKvisual\Wrapping\Python\vtk\__init__.py", line 42, in <module>
from vtkFilteringPython import *
ImportError: No module named vtkFilteringPython
Any thoughts that why this is happening?
Thanks
It looks like you've added the location of the VTK package directory, containing .py files such as "filtering.py" and "vtkFilteringPython.pyd", to your PYTHONPATH.
However, now you need to add both this directory and also the directory containing vtkFilteringPythonD.dll and the other DLLs to your PATH. The location of this directory depends on whether you've just run the build, or also the INSTALL target. Usually it's in "VTK\bin" or "VTK\bin\BUILDTARGET" somewhere, where BUILDTARGET is for example Debug or Release.
Try running sudo apt-get install python-vtk
If you're only using the Python wrappers, right now, you can just install it from PyPI. Just do pip install vtk and you'll get the current version (which is now 8.1).
Look here for the announcement.