标签归档:winapi

ImportError:没有名为win32api的模块

问题:ImportError:没有名为win32api的模块

我使用Python 2.7,我想使用pywin32-214Windows 7。我pywin32-214通过使用msi安装程序进行安装。但是,当我导入win32apiPython脚本时,它会引发错误:

no module named win32api. 

我该怎么办?我可以使用pywin32 apiWindows 7

I am using Python 2.7 and I want to use pywin32-214 on Windows 7. I installed pywin32-214 by using the msi installer. But when I import win32api in my Python script, it throws the error:

no module named win32api. 

What should I do? Can I use pywin32 api for Windows 7?


回答 0

这可以解决我的情况,如在 哪里可以找到Python的win32api模块?

pip install pypiwin32

This is resolve my case as found on Where to find the win32api module for Python?

pip install pypiwin32

回答 1

我遇到了一个相同的问题,通过重新启动Python编辑器和Shell解决了该问题。我已经安装了,pywin32但是直到重新启动后才拾取新模块。

如果您已经这样做了,请在Python安装中进行搜索,win32api然后win32api.pyd在下找到${PYTHON_HOME}\Lib\site-packages\win32

I had an identical problem, which I solved by restarting my Python editor and shell. I had installed pywin32 but the new modules were not picked up until the restarts.

If you’ve already done that, do a search in your Python installation for win32api and you should find win32api.pyd under ${PYTHON_HOME}\Lib\site-packages\win32.


回答 2

根据pywin32 github你必须运行

    pip install pywin32

然后,您必须运行

    python Scripts/pywin32_postinstall.py -install

我知道我正在恢复一个旧线程,但是我只是遇到了这个问题,这是解决它的唯一方法。

According to pywin32 github you must run

    pip install pywin32

and after that, you must run

    python Scripts/pywin32_postinstall.py -install

I know I’m reviving an old thread, but I just had this problem and this was the only way to solve it.


回答 3

在我的Python 3发行版中,我没有找到投票率最高的答案。

我有同样的问题,并解决了安装模块pywin32的问题:

在普通的python中:

pip install pywin32

在水蟒中:

conda install pywin32

我的python安装(用于Python的英特尔®分发)存在某种依赖性问题,并出现此错误。安装此模块后,它停止出现。

I didn’t find the package of the most voted answer in my Python 3 dist.

I had the same problem and solved it installing the module pywin32:

In a normal python:

pip install pywin32

In anaconda:

conda install pywin32

My python installation (Intel® Distribution for Python) had some kind of dependency problem and was giving this error. After installing this module it stopped appearing.


回答 4

安装pywin32之后

正确安装模块的步骤(pywin32)

  1. 第一次搜索您的python pip在哪里

    1a。例如在我的情况下pip的位置-C:\ Users \ username \ AppData \ Local \ Programs \ Python \ Python36-32 \ Scripts

  2. 然后打开命令提示符,并将目录更改为您的pip文件夹位置。

    cd C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts
    
    C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>pip install 
    pypiwin32

重新启动IDE

现在所有操作都可以使用该模块了。

After installing pywin32

Steps to correctly install your module (pywin32)

  1. First search where is your python pip is present

    1a. For Example in my case location of pip – C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts

  2. Then open your command prompt and change directory to your pip folder location.

    cd C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts
    
    C:\Users\username\AppData\Local\Programs\Python\Python36-32\Scripts>pip install 
    pypiwin32
    

Restart your IDE

All done now you can use the module .


在哪里可以找到适用于Python的win32api模块?[关闭]

问题:在哪里可以找到适用于Python的win32api模块?[关闭]

我需要为Python 2.7下载它,但似乎找不到它…

I need to download it for Python 2.7, but can’t seem to find it…


回答 0

“ pywin32”是其规范名称。

http://sourceforge.net/projects/pywin32/


回答 1

还有一个新的选择:通过点子获取它!有一个包pypiwin32可用轮子,这样你就可以用刚安装:pip install pypiwin32

编辑:根据@movermeyer的评论,主项目现在在pywin32上发布了wheel ,因此可以使用pip install pywin32

There is a a new option as well: get it via pip! There is a package pypiwin32 with wheels available, so you can just install with: pip install pypiwin32!

Edit: Per comment from @movermeyer, the main project now publishes wheels at pywin32, and so can be installed with pip install pywin32


回答 2

我发现UC Irvine拥有大量的python模块集合,pywin32(win32api)是其中列出的众多模块之一。我不确定它们如何跟上这些模块的最新版本,但还没有让我失望。

UC Irvine Python扩展存储库-http: //www.lfd.uci.edu/~gohlke/pythonlibs

pywin32模块- http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32

I’ve found that UC Irvine has a great collection of python modules, pywin32 (win32api) being one of many listed there. I’m not sure how they do with keeping up with the latest versions of these modules but it hasn’t let me down yet.

UC Irvine Python Extension Repository – http://www.lfd.uci.edu/~gohlke/pythonlibs

pywin32 module – http://www.lfd.uci.edu/~gohlke/pythonlibs/#pywin32


回答 3