Anaconda安装后运行pyinstaller导致ImportError:没有名为'pefile'的模块

时间:2016-09-27 15:04:52

标签: python anaconda pyinstaller

我根据Anaconda's website做了conda install -c acellera pyinstaller=3.2.3,看起来它安装正确但如果我尝试通过cmd运行它,我会得到以下内容:

C:\Users\Cornelis Dirk Haupt\PycharmProjects\Mesoscale-Brain-Explorer\src>pyinstaller
Traceback (most recent call last):
  File "C:\Anaconda3\Scripts\pyinstaller-script.py", line 9, in <module>
    load_entry_point('PyInstaller==3.3.dev0+g8756735', 'console_scripts', 'pyinstaller')()
  File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 542, in load_entry_point
  File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2569, in load_entry_point
  File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2229, in load
  File "C:\Anaconda3\lib\site-packages\setuptools-23.0.0-py3.5.egg\pkg_resources\__init__.py", line 2235, in resolve
  File "C:\Anaconda3\lib\site-packages\PyInstaller\__main__.py", line 21, in <module>
    import PyInstaller.building.build_main
  File "C:\Anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 34, in <module>
    from .api import PYZ, EXE, COLLECT, MERGE
  File "C:\Anaconda3\lib\site-packages\PyInstaller\building\api.py", line 38, in <module>
    from PyInstaller.utils.win32 import winmanifest, icon, versioninfo, winresource
  File "C:\Anaconda3\lib\site-packages\PyInstaller\utils\win32\versioninfo.py", line 17, in <module>
    import pefile
ImportError: No module named 'pefile'

发生了什么事? Pyinstaller与没有Anaconda的python 2.7一起工作正常。但我最近决定跳到Anaconda + 3.5。我找不到任何名为pefile的模块或如何使用Anaconda安装它。我可以使用pip3轻松安装pefile。

2 个答案:

答案 0 :(得分:6)

您可以使用Anaconda的点来安装它,只需转到Anaconda的Script文件夹并执行:

pip.exe install pefile

答案 1 :(得分:4)

安装此代码:

conda install -c conda-forge pyinstaller=3.2.1
经过几次尝试,我的工作正常!