通过 pip 安装 pptx 以解决 enthought canopy 错误

Installing pptx via pip for enthought canopy error

我无法设置 pptx 以使用 enthought canopy(我使用的是 Windows 8)。

使用pip安装过程中出现以下异常。请注意,在异常发生之前,Pillow 已被卸载。这是我唯一认为出错的地方。

 ...running install_egg_info
    running egg_info
    writing requirements to python_pptx.egg-info\requires.txt
    writing python_pptx.egg-info\PKG-INFO
    writing top-level names to python_pptx.egg-info\top_level.txt
    writing dependency_links to python_pptx.egg-info\dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'python_pptx.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'python_pptx.egg-info\SOURCES.txt'
    Copying python_pptx.egg-info to C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\Lib\site-packages\python_pptx-0.5.6-py2.7.egg-info
    running install_scripts
    writing list of installed files to 'c:\users\dirkh_000\appdata\local\temp\pip-guwbzu-record\install-record.txt'
  Found existing installation: Pillow 1.7.6
    Uninstalling Pillow:
      Removing file or directory c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilconvert.py
      Removing file or directory c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pildriver.py
      Removing file or directory c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilfile.py
      Removing file or directory c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilfont.py
      Removing file or directory c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilprint.py
      Successfully uninstalled Pillow
  Rolling back uninstall of Pillow
  Replacing c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilconvert.py
  Replacing c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pildriver.py
  Replacing c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilfile.py
  Replacing c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilfont.py
  Replacing c:\users\dirkh_000\appdata\local\enthought\canopy\user\scripts\pilprint.py
Cleaning up...
  Removing temporary dir C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\build...
        Exception:
    Traceback (most recent call last):
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\basecommand.py", line 122, in main
        status = self.run(options, args)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\commands\install.py", line 283, in run
        requirement_set.install(install_options, global_options, root=options.root_path)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\req.py", line 1435, in install
        requirement.install(install_options, global_options, *args, **kwargs)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\req.py", line 671, in install
        self.move_wheel_files(self.source_dir, root=root)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\req.py", line 901, in move_wheel_files
        pycompile=self.pycompile,
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\wheel.py", line 215, in move_wheel_files
        clobber(source, lib_dir, True)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\lib\site-packages\pip\wheel.py", line 209, in clobber
        shutil.copy2(srcfile, destfile)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.4.1.1975.win-x86_64\lib\shutil.py", line 130, in copy2
        copyfile(src, dst)
      File "C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.4.1.1975.win-x86_64\lib\shutil.py", line 83, in copyfile
        with open(dst, 'wb') as fdst:
    IOError: [Errno 13] Permission denied: u'C:\Users\dirkh_000\AppData\Local\Enthought\Canopy\User\Lib\site-packages\PIL\_imaging.pyd'

可根据要求提供完整的调试日志。 当前在 canopy 中输入 import pptx 会产生:ImportError: No module named _util

我认为这只是目录不匹配的问题,但我不确定如何检查是否是这种情况

当 Canopy 运行 时我可以重现这个问题,但当 Canopy 是 不是运行.

推测原因:_imaging.pyd 文件(它是一个 Windows .DLL)在使用时无法替换它。

所以退出 Canopy 并重试。

其他使用PIL的包会有什么后果,我不知道。