python - 由于警告和 ValueError,无法在 Windows 的 virtualenv 中 pip 安装 PIL

标签 python windows python-imaging-library virtualenv pip

我正在尝试在 virtualenv 中安装 PIL 但失败了。我创建了一个全新的 virtualenv 并执行了 pip install PIL 并获得了以下内容

C:\Users\s3z\Desktop\My Dropbox\pythons\ham>Scripts\activate
(ham) C:\Users\s3z\Desktop\My Dropbox\pythons\ham>pip install PIL
Downloading/unpacking PIL
  Downloading PIL-1.1.7.tar.gz (506Kb): 506Kb downloaded
  Running setup.py egg_info for package PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

Installing collected packages: PIL
  Running setup.py install for PIL
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    building '_imaging' extension
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\build\PIL\setup.py", line 486, in <module>
        version=VERSION,
      File "C:\Python27\Lib\distutils\core.py", line 152, in setup
        dist.run_commands()
      File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\lib\site-packages\distribute-0.6.24-py2.7.egg\setuptools\command\install.py", line 53, in
run
        return _install.run(self)
      File "C:\Python27\Lib\distutils\command\install.py", line 563, in run
        self.run_command('build')
      File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Python27\Lib\distutils\command\build.py", line 127, in run
        self.run_command(cmd_name)
      File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command
        self.distribution.run_command(command)
      File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command
        cmd_obj.run()
      File "C:\Python27\Lib\distutils\command\build_ext.py", line 340, in run
        self.build_extensions()
      File "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\build\PIL\setup.py", line 368, in build_extensions
        build_ext.build_extensions(self)
      File "C:\Python27\Lib\distutils\command\build_ext.py", line 449, in build_extensions
        self.build_extension(ext)
      File "C:\Python27\Lib\distutils\command\build_ext.py", line 499, in build_extension
        depends=ext.depends)
      File "C:\Python27\Lib\distutils\msvc9compiler.py", line 469, in compile
        self.initialize()
      File "C:\Python27\Lib\distutils\msvc9compiler.py", line 379, in initialize
        vc_env = query_vcvarsall(VERSION, plat_spec)
      File "C:\Python27\Lib\distutils\msvc9compiler.py", line 295, in query_vcvarsall
        raise ValueError(str(list(result.keys())))
    ValueError: [u'path']
    Complete output from command "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\Scripts\python.exe" -c "import setuptools;__file__='C:\\Users\\s3z
\\Desktop\\My Dropbox\\pythons\\ham\\build\\PIL\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --s
ingle-version-externally-managed --record c:\users\s3z\appdata\local\temp\pip-f7ttlx-record\install-record.txt --install-headers "C:\Users\s3z
\Desktop\My Dropbox\pythons\ham\include\site\python2.7":
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py

running install

running build

running build_py

creating build

creating build\lib.win-amd64-2.7

copying PIL\ArgImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\BdfFontFile.py -> build\lib.win-amd64-2.7

copying PIL\BmpImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\BufrStubImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\ContainerIO.py -> build\lib.win-amd64-2.7

copying PIL\CurImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\DcxImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\EpsImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\ExifTags.py -> build\lib.win-amd64-2.7

copying PIL\FitsStubImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\FliImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\FontFile.py -> build\lib.win-amd64-2.7

copying PIL\FpxImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\GbrImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\GdImageFile.py -> build\lib.win-amd64-2.7

copying PIL\GifImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\GimpGradientFile.py -> build\lib.win-amd64-2.7

copying PIL\GimpPaletteFile.py -> build\lib.win-amd64-2.7

copying PIL\GribStubImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\Hdf5StubImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\IcnsImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\IcoImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\Image.py -> build\lib.win-amd64-2.7

copying PIL\ImageChops.py -> build\lib.win-amd64-2.7

copying PIL\ImageCms.py -> build\lib.win-amd64-2.7

copying PIL\ImageColor.py -> build\lib.win-amd64-2.7

copying PIL\ImageDraw.py -> build\lib.win-amd64-2.7

copying PIL\ImageDraw2.py -> build\lib.win-amd64-2.7

copying PIL\ImageEnhance.py -> build\lib.win-amd64-2.7

copying PIL\ImageFile.py -> build\lib.win-amd64-2.7

copying PIL\ImageFileIO.py -> build\lib.win-amd64-2.7

copying PIL\ImageFilter.py -> build\lib.win-amd64-2.7

copying PIL\ImageFont.py -> build\lib.win-amd64-2.7

copying PIL\ImageGL.py -> build\lib.win-amd64-2.7

copying PIL\ImageGrab.py -> build\lib.win-amd64-2.7

copying PIL\ImageMath.py -> build\lib.win-amd64-2.7

copying PIL\ImageMode.py -> build\lib.win-amd64-2.7

copying PIL\ImageOps.py -> build\lib.win-amd64-2.7

copying PIL\ImagePalette.py -> build\lib.win-amd64-2.7

copying PIL\ImagePath.py -> build\lib.win-amd64-2.7

copying PIL\ImageQt.py -> build\lib.win-amd64-2.7

copying PIL\ImageSequence.py -> build\lib.win-amd64-2.7

copying PIL\ImageShow.py -> build\lib.win-amd64-2.7

copying PIL\ImageStat.py -> build\lib.win-amd64-2.7

copying PIL\ImageTk.py -> build\lib.win-amd64-2.7

copying PIL\ImageTransform.py -> build\lib.win-amd64-2.7

copying PIL\ImageWin.py -> build\lib.win-amd64-2.7

copying PIL\ImImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\ImtImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\IptcImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\JpegImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\McIdasImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\MicImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\MpegImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\MspImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\OleFileIO.py -> build\lib.win-amd64-2.7

copying PIL\PaletteFile.py -> build\lib.win-amd64-2.7

copying PIL\PalmImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PcdImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PcfFontFile.py -> build\lib.win-amd64-2.7

copying PIL\PcxImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PdfImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PixarImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PngImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PpmImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PsdImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\PSDraw.py -> build\lib.win-amd64-2.7

copying PIL\SgiImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\SpiderImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\SunImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\TarIO.py -> build\lib.win-amd64-2.7

copying PIL\TgaImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\TiffImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\TiffTags.py -> build\lib.win-amd64-2.7

copying PIL\WalImageFile.py -> build\lib.win-amd64-2.7

copying PIL\WmfImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\XbmImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\XpmImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\XVThumbImagePlugin.py -> build\lib.win-amd64-2.7

copying PIL\__init__.py -> build\lib.win-amd64-2.7

running build_ext

building '_imaging' extension

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\build\PIL\setup.py", line 486, in <module>

    version=VERSION,

  File "C:\Python27\Lib\distutils\core.py", line 152, in setup

    dist.run_commands()

  File "C:\Python27\Lib\distutils\dist.py", line 953, in run_commands

    self.run_command(cmd)

  File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command

    cmd_obj.run()

  File "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\lib\site-packages\distribute-0.6.24-py2.7.egg\setuptools\command\install.py", line 53, in run

    return _install.run(self)

  File "C:\Python27\Lib\distutils\command\install.py", line 563, in run

    self.run_command('build')

  File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command

    self.distribution.run_command(command)

  File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command

    cmd_obj.run()

  File "C:\Python27\Lib\distutils\command\build.py", line 127, in run

    self.run_command(cmd_name)

  File "C:\Python27\Lib\distutils\cmd.py", line 326, in run_command

    self.distribution.run_command(command)

  File "C:\Python27\Lib\distutils\dist.py", line 972, in run_command

    cmd_obj.run()

  File "C:\Python27\Lib\distutils\command\build_ext.py", line 340, in run

    self.build_extensions()

  File "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\build\PIL\setup.py", line 368, in build_extensions

    build_ext.build_extensions(self)

  File "C:\Python27\Lib\distutils\command\build_ext.py", line 449, in build_extensions

    self.build_extension(ext)

  File "C:\Python27\Lib\distutils\command\build_ext.py", line 499, in build_extension

    depends=ext.depends)

  File "C:\Python27\Lib\distutils\msvc9compiler.py", line 469, in compile

    self.initialize()

  File "C:\Python27\Lib\distutils\msvc9compiler.py", line 379, in initialize

    vc_env = query_vcvarsall(VERSION, plat_spec)

  File "C:\Python27\Lib\distutils\msvc9compiler.py", line 295, in query_vcvarsall

    raise ValueError(str(list(result.keys())))

ValueError: [u'path']

----------------------------------------
Command "C:\Users\s3z\Desktop\My Dropbox\pythons\ham\Scripts\python.exe" -c "import setuptools;__file__='C:\\Users\\s3z\\Desktop\\My Dropbox\\
pythons\\ham\\build\\PIL\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-
managed --record c:\users\s3z\appdata\local\temp\pip-f7ttlx-record\install-record.txt --install-headers "C:\Users\s3z\Desktop\My Dropbox\pytho
ns\ham\include\site\python2.7" failed with error code 1 in C:\Users\s3z\Desktop\My Dropbox\pythons\ham\build\PIL
Storing complete log in C:\Users\s3z\AppData\Roaming\pip\pip.log

这里出了什么问题?以及如何在virtualenv中成功安装PIL?

最佳答案

使用 PIP 在 Windows 上安装 PIL 时出现问题,但使用 easy_install 工作正常。

"c:\VirtualENV\easy_install PIL"

关于python - 由于警告和 ValueError,无法在 Windows 的 virtualenv 中 pip 安装 PIL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10334355/

相关文章:

python - 类属性的多个值

Python - 如果两列为 NaN,则删除行

python - 达到分数限制时程序不会终止吗?

windows - 提取并创建包含 aux/aux.* 的 .jar 存档

java - Windows Hello API

python - 在python中的蒙版外的图像上添加模糊/渐变

python - 用线条粗细在Python PIL中绘制椭圆

python - 为什么台球多处理模块需要 "if __name__==' __main_ _'"行?

windows - docker-machine:没有机器名,不存在 "default"

python - 将彩色表情符号插入图像(Python)