Microsoft Azure Django Python 安装错误 Pillow
Microsoft Azure Django Python setup error Pillow
所有使用 Microsoft Azure 的新手都需要帮助部署 Django 应用程序。当我将代码从我的本地存储库推送到 Azure 时,它会给我这个日志。
我注意到它说:
找不到 zlib 的头文件或库文件,这是必需的
从源代码编译 Pillow 时的依赖性。请看安装
说明在
https://pillow.readthedocs.io/en/latest/installation.html
我读了更多书,了解到 Azure 无法从环境中安装 PIL 或 Pillow,因此需要在我的系统上安装然后上传到 Azure。我包含了一个名为“.skipPythonDeployment”的文件,这样它就不会删除我本地系统上设置的环境,但部署会再次失败。
下面附上Pushing code to Azure时生成的Log的重要部分。
Detected requirements.txt. You can skip Python specific steps with
a .skipPythonDeployment file. Detecting Python runtime from site
configuration Detected python-2.7 Deleting incompatible virtual
environment.
............................................................ Creating
python-2.7 virtual environment.
Downloading/unpacking pillow (from -r requirements.txt (line 4))
.... Running setup.py
(path:D:\home\site\wwwroot\env\build\pillow\setup.py) egg_info for
package pillow
Single threaded build for windows
warning: no files found matching '.sh'
no previously-included directories found matching 'docs_static'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching '.travis'
warning: no previously-included files found matching '.travis*'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'build_children.sh'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files matching '.git' found anywhere in distribution
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '.so' found anywhere in distribution
warning: no files found matching '.sh'
no previously-included directories found matching 'docs_static'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching '.travis'
warning: no previously-included files found matching '.travis*'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'build_children.sh'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files matching '.git' found anywhere in distribution
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '.so' found anywhere in distribution Downloading/unpacking Werkzeug (from -r
requirements.txt (line 5)) Downloading/unpacking flask-cors (from -r
requirements.txt (line 6)) Downloading
Flask_Cors-3.0.2-py2.py3-none-any.whl Downloading/unpacking
Flask>=0.8 (from flask-restful->-r requirements.txt (line 1))
Downloading/unpacking pytz (from flask-restful->-r requirements.txt
(line 1)) Downloading/unpacking six>=1.3.0 (from flask-restful->-r
requirements.txt (line 1)) Downloading
six-1.10.0-py2.py3-none-any.whl Downloading/unpacking aniso8601>=0.82
(from flask-restful->-r requirements.txt (line 1)) Running setup.py
(path:D:\home\site\wwwroot\env\build\aniso8601\setup.py) egg_info for
package aniso8601
Downloading/unpacking olefile (from pillow->-r requirements.txt (line 4)) Running setup.py
(path:D:\home\site\wwwroot\env\build\olefile\setup.py) egg_info for
package olefile
Downloading/unpacking itsdangerous>=0.21 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Running
setup.py (path:D:\home\site\wwwroot\env\build\itsdangerous\setup.py)
egg_info for package itsdangerous
warning: no previously-included files matching '' found under directory 'docs_build' Downloading/unpacking Jinja2>=2.4 (from
Flask>=0.8->flask-restful->-r requirements.txt (line 1))
Downloading/unpacking click>=2.0 (from Flask>=0.8->flask-restful->-r
requirements.txt (line 1)) Downloading/unpacking python-dateutil
(from aniso8601>=0.82->flask-restful->-r requirements.txt (line 1))
Downloading/unpacking MarkupSafe>=0.23 (from
Jinja2>=2.4->Flask>=0.8->flask-restful->-r requirements.txt (line 1))
Downloading MarkupSafe-1.0.tar.gz Running setup.py
(path:D:\home\site\wwwroot\env\build\MarkupSafe\setup.py) egg_info for
package MarkupSafe
Installing collected packages: flask-restful, numpy, pydicom, pillow, Werkzeug, flask-cors, Flask, pytz, six, aniso8601, olefile,
itsdangerous, Jinja2, click, python-dateutil, MarkupSafe
.................. : .................. Running setup.py install
for pydicom .
.. Running setup.py install for pillow
Single threaded build for windows
warning: no files found matching '.sh'
no previously-included directories found matching 'docs_static'
warning: no previously-included files found matching '.coveragerc'
warning: no previously-included files found matching '.editorconfig'
warning: no previously-included files found matching '.landscape.yaml'
warning: no previously-included files found matching '.travis'
warning: no previously-included files found matching '.travis*'
warning: no previously-included files found matching 'appveyor.yml'
warning: no previously-included files found matching 'build_children.sh'
warning: no previously-included files found matching 'tox.ini'
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '.pyc' found anywhere in distribution
warning: no previously-included files matching '.so' found anywhere in distribution
The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\home\site\wwwroot\env\build\pillow\setup.py", line 756, in <module>
raise RequiredDependencyException(msg)
__main__.RequiredDependencyException:
The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
Complete output from command D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools,
tokenize;file='D:\home\site\wwwroot\env\build\pillow\setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record
d:\local\temp\pip-nu1mtm-record\install-record.txt
--single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7:
Single threaded build for windows running install running build running build_py creating build creating
build\lib.win32-2.7 creating build\lib.win32-2.7\PIL copying
PIL\BdfFontFile.py -> build\lib.win32-2.7\PIL copying
PIL\BmpImagePlugin.py -> build\lib.win32-2.7\PIL copying
PIL\BufrStubImagePlugin.py -> build\lib.win32-2.7\PIL copying
PIL\ContainerIO.py -> build\lib.win32-2.7\PIL copying
PIL\CurImagePlugin.py -> build\lib.win32-2.7\PIL copying
PIL\DcxImagePlugin.py -> build\lib.win32-2.7\PIL copying
PIL\DdsImagePlugin.py -> build\lib.win32-2.7\PIL copying
PIL\EpsImagePlugin.py -> build\lib.win32-2.7\PIL copying
PIL\ExifTags.py -> build\lib.win32-2.7\PIL copying PIL\features.py
-> build\lib.win32-2.7\PIL copying PIL\FitsStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FliImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\FontFile.py ->
build\lib.win32-2.7\PIL copying PIL\FpxImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\FtexImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\GbrImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\GdImageFile.py ->
build\lib.win32-2.7\PIL copying PIL\GifImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\GimpGradientFile.py ->
build\lib.win32-2.7\PIL copying PIL\GimpPaletteFile.py ->
build\lib.win32-2.7\PIL copying PIL\GribStubImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\Hdf5StubImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\IcnsImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\IcoImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\Image.py ->
build\lib.win32-2.7\PIL copying PIL\ImageChops.py ->
build\lib.win32-2.7\PIL copying PIL\ImageCms.py ->
build\lib.win32-2.7\PIL copying PIL\ImageColor.py ->
build\lib.win32-2.7\PIL copying PIL\ImageDraw.py ->
build\lib.win32-2.7\PIL copying PIL\ImageDraw2.py ->
build\lib.win32-2.7\PIL copying PIL\ImageEnhance.py ->
build\lib.win32-2.7\PIL copying PIL\ImageFile.py ->
build\lib.win32-2.7\PIL copying PIL\ImageFilter.py ->
build\lib.win32-2.7\PIL copying PIL\ImageFont.py ->
build\lib.win32-2.7\PIL copying PIL\ImageGrab.py ->
build\lib.win32-2.7\PIL copying PIL\ImageMath.py ->
build\lib.win32-2.7\PIL copying PIL\ImageMode.py ->
build\lib.win32-2.7\PIL copying PIL\ImageMorph.py ->
build\lib.win32-2.7\PIL copying PIL\ImageOps.py ->
build\lib.win32-2.7\PIL copying PIL\ImagePalette.py ->
build\lib.win32-2.7\PIL copying PIL\ImagePath.py ->
build\lib.win32-2.7\PIL copying PIL\ImageQt.py ->
build\lib.win32-2.7\PIL copying PIL\ImageSequence.py ->
build\lib.win32-2.7\PIL copying PIL\ImageShow.py ->
build\lib.win32-2.7\PIL copying PIL\ImageStat.py ->
build\lib.win32-2.7\PIL copying PIL\ImageTk.py ->
build\lib.win32-2.7\PIL copying PIL\ImageTransform.py ->
build\lib.win32-2.7\PIL copying PIL\ImageWin.py ->
build\lib.win32-2.7\PIL copying PIL\ImImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\ImtImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\IptcImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\Jpeg2KImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\JpegImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\JpegPresets.py ->
build\lib.win32-2.7\PIL copying PIL\McIdasImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\MicImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\MpegImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\MpoImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\MspImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\OleFileIO.py ->
build\lib.win32-2.7\PIL copying PIL\PaletteFile.py ->
build\lib.win32-2.7\PIL copying PIL\PalmImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PcdImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PcfFontFile.py ->
build\lib.win32-2.7\PIL copying PIL\PcxImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PdfImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PixarImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PngImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PpmImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PsdImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\PSDraw.py ->
build\lib.win32-2.7\PIL copying PIL\PyAccess.py ->
build\lib.win32-2.7\PIL copying PIL\SgiImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\SpiderImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\SunImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\TarIO.py ->
build\lib.win32-2.7\PIL copying PIL\TgaImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\TiffImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\TiffTags.py ->
build\lib.win32-2.7\PIL copying PIL\WalImageFile.py ->
build\lib.win32-2.7\PIL copying PIL\WebPImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\WmfImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\XbmImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\XpmImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL\XVThumbImagePlugin.py ->
build\lib.win32-2.7\PIL copying PIL_binary.py ->
build\lib.win32-2.7\PIL copying PIL_tkinter_finder.py ->
build\lib.win32-2.7\PIL copying PIL_util.py ->
build\lib.win32-2.7\PIL copying PIL__init__.py ->
build\lib.win32-2.7\PIL running egg_info writing requirements to
Pillow.egg-info\requires.txt writing Pillow.egg-info\PKG-INFO
writing top-level names to Pillow.egg-info\top_level.txt writing
dependency_links to Pillow.egg-info\dependency_links.txt warning:
manifest_maker: standard file '-c' not found
reading manifest file 'Pillow.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching
'.sh' no previously-included directories found matching
'docs_static' warning: no previously-included files found matching
'.coveragerc' warning: no previously-included files found matching
'.editorconfig' warning: no previously-included files found
matching '.landscape.yaml' warning: no previously-included files
found matching '.travis' warning: no previously-included files
found matching '.travis*' warning: no previously-included files
found matching 'appveyor.yml' warning: no previously-included files
found matching 'build_children.sh' warning: no previously-included
files found matching 'tox.ini' warning: no previously-included
files matching '.git' found anywhere in distribution warning: no
previously-included files matching '.pyc' found anywhere in
distribution warning: no previously-included files matching '.so'
found anywhere in distribution writing manifest file
'Pillow.egg-info\SOURCES.txt' running build_ext
The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\home\site\wwwroot\env\build\pillow\setup.py", line 756, in <module>
raise RequiredDependencyException(msg) __main__.RequiredDependencyException:
The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source.
Please see the install instructions at:
https://pillow.readthedocs.io/en/latest/installation.html
---------------------------------------- Cleaning up... .................................................... Command
D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools,
tokenize;file='D:\home\site\wwwroot\env\build\pillow\setup.py';exec(compile(getattr(tokenize,
'open', open)(file).read().replace('\r\n', '\n'), file,
'exec'))" install --record
d:\local\temp\pip-nu1mtm-record\install-record.txt
--single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7 failed with error code
1 in D:\home\site\wwwroot\env\build\pillow Storing debug log for
failure in D:\home\pip\pip.log An error has occurred during web site
deployment. Error - Changes committed to remote repository but
deployment to website failed.
谢谢
您的 pip 太旧,无法下载 whl(Python 默认版本的已知问题)。请更新您的 Python 安装或直接更新 pip:
https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/
您似乎正在使用 Azure Web Apps/App 服务来部署包含 Pillow
包的 Django 应用程序,并且 Pillow
包似乎是您在 requirements.txt
喜欢 Pillow>=2.0.0
.
但是,不幸的是,在 Azure 应用服务上使用 Pillow
包存在两个问题。
Pillow 包含将应用程序部署到 Azure 时需要编译的 C 代码。解决方法是需要自己构建一个Pillow的wheel文件添加到你的项目中,并在requirements.txt
中声明wheel文件,具体请参考Azure官方Django教程Troubleshooting - Package Installation部分了解它.
Pillow 作为 Python 的图像库需要 GDI API 和资源。在 Azure 应用服务上,任何 GDI 调用都受到限制和阻止,请参阅 here 了解。
所以部署 Django 应用程序的唯一方法是使用 Azure VM。
所有使用 Microsoft Azure 的新手都需要帮助部署 Django 应用程序。当我将代码从我的本地存储库推送到 Azure 时,它会给我这个日志。
我注意到它说:
找不到 zlib 的头文件或库文件,这是必需的
从源代码编译 Pillow 时的依赖性。请看安装
说明在
https://pillow.readthedocs.io/en/latest/installation.html
我读了更多书,了解到 Azure 无法从环境中安装 PIL 或 Pillow,因此需要在我的系统上安装然后上传到 Azure。我包含了一个名为“.skipPythonDeployment”的文件,这样它就不会删除我本地系统上设置的环境,但部署会再次失败。
下面附上Pushing code to Azure时生成的Log的重要部分。
Detected requirements.txt. You can skip Python specific steps with a .skipPythonDeployment file. Detecting Python runtime from site configuration Detected python-2.7 Deleting incompatible virtual environment. ............................................................ Creating python-2.7 virtual environment.
Downloading/unpacking pillow (from -r requirements.txt (line 4)) .... Running setup.py (path:D:\home\site\wwwroot\env\build\pillow\setup.py) egg_info for package pillow Single threaded build for windows
warning: no files found matching '.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution warning: no files found matching '.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution Downloading/unpacking Werkzeug (from -r requirements.txt (line 5)) Downloading/unpacking flask-cors (from -r requirements.txt (line 6)) Downloading Flask_Cors-3.0.2-py2.py3-none-any.whl Downloading/unpacking Flask>=0.8 (from flask-restful->-r requirements.txt (line 1)) Downloading/unpacking pytz (from flask-restful->-r requirements.txt (line 1)) Downloading/unpacking six>=1.3.0 (from flask-restful->-r requirements.txt (line 1)) Downloading six-1.10.0-py2.py3-none-any.whl Downloading/unpacking aniso8601>=0.82 (from flask-restful->-r requirements.txt (line 1)) Running setup.py (path:D:\home\site\wwwroot\env\build\aniso8601\setup.py) egg_info for package aniso8601 Downloading/unpacking olefile (from pillow->-r requirements.txt (line 4)) Running setup.py (path:D:\home\site\wwwroot\env\build\olefile\setup.py) egg_info for package olefile Downloading/unpacking itsdangerous>=0.21 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Running setup.py (path:D:\home\site\wwwroot\env\build\itsdangerous\setup.py) egg_info for package itsdangerous
warning: no previously-included files matching '' found under directory 'docs_build' Downloading/unpacking Jinja2>=2.4 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Downloading/unpacking click>=2.0 (from Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Downloading/unpacking python-dateutil (from aniso8601>=0.82->flask-restful->-r requirements.txt (line 1)) Downloading/unpacking MarkupSafe>=0.23 (from Jinja2>=2.4->Flask>=0.8->flask-restful->-r requirements.txt (line 1)) Downloading MarkupSafe-1.0.tar.gz Running setup.py (path:D:\home\site\wwwroot\env\build\MarkupSafe\setup.py) egg_info for package MarkupSafe Installing collected packages: flask-restful, numpy, pydicom, pillow, Werkzeug, flask-cors, Flask, pytz, six, aniso8601, olefile, itsdangerous, Jinja2, click, python-dateutil, MarkupSafe .................. : .................. Running setup.py install for pydicom . .. Running setup.py install for pillow Single threaded build for windows warning: no files found matching '.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git*' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source.
Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.htmlTraceback (most recent call last): File "<string>", line 1, in <module> File "D:\home\site\wwwroot\env\build\pillow\setup.py", line 756, in <module> raise RequiredDependencyException(msg) __main__.RequiredDependencyException: The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html Complete output from command D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools,
tokenize;file='D:\home\site\wwwroot\env\build\pillow\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record d:\local\temp\pip-nu1mtm-record\install-record.txt --single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7: Single threaded build for windows running install running build running build_py creating build creating build\lib.win32-2.7 creating build\lib.win32-2.7\PIL copying PIL\BdfFontFile.py -> build\lib.win32-2.7\PIL copying PIL\BmpImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\BufrStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\ContainerIO.py -> build\lib.win32-2.7\PIL copying PIL\CurImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\DcxImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\DdsImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\EpsImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\ExifTags.py -> build\lib.win32-2.7\PIL copying PIL\features.py -> build\lib.win32-2.7\PIL copying PIL\FitsStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FliImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FontFile.py -> build\lib.win32-2.7\PIL copying PIL\FpxImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\FtexImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\GbrImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\GdImageFile.py -> build\lib.win32-2.7\PIL copying PIL\GifImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\GimpGradientFile.py -> build\lib.win32-2.7\PIL copying PIL\GimpPaletteFile.py -> build\lib.win32-2.7\PIL copying PIL\GribStubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\Hdf5StubImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\IcnsImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\IcoImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\Image.py -> build\lib.win32-2.7\PIL copying PIL\ImageChops.py -> build\lib.win32-2.7\PIL copying PIL\ImageCms.py -> build\lib.win32-2.7\PIL copying PIL\ImageColor.py -> build\lib.win32-2.7\PIL copying PIL\ImageDraw.py -> build\lib.win32-2.7\PIL copying PIL\ImageDraw2.py -> build\lib.win32-2.7\PIL copying PIL\ImageEnhance.py -> build\lib.win32-2.7\PIL copying PIL\ImageFile.py -> build\lib.win32-2.7\PIL copying PIL\ImageFilter.py -> build\lib.win32-2.7\PIL copying PIL\ImageFont.py -> build\lib.win32-2.7\PIL copying PIL\ImageGrab.py -> build\lib.win32-2.7\PIL copying PIL\ImageMath.py -> build\lib.win32-2.7\PIL copying PIL\ImageMode.py -> build\lib.win32-2.7\PIL copying PIL\ImageMorph.py -> build\lib.win32-2.7\PIL copying PIL\ImageOps.py -> build\lib.win32-2.7\PIL copying PIL\ImagePalette.py -> build\lib.win32-2.7\PIL copying PIL\ImagePath.py -> build\lib.win32-2.7\PIL copying PIL\ImageQt.py -> build\lib.win32-2.7\PIL copying PIL\ImageSequence.py -> build\lib.win32-2.7\PIL copying PIL\ImageShow.py -> build\lib.win32-2.7\PIL copying PIL\ImageStat.py -> build\lib.win32-2.7\PIL copying PIL\ImageTk.py -> build\lib.win32-2.7\PIL copying PIL\ImageTransform.py -> build\lib.win32-2.7\PIL copying PIL\ImageWin.py -> build\lib.win32-2.7\PIL copying PIL\ImImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\ImtImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\IptcImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\Jpeg2KImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\JpegImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\JpegPresets.py -> build\lib.win32-2.7\PIL copying PIL\McIdasImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MicImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MpegImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MpoImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\MspImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\OleFileIO.py -> build\lib.win32-2.7\PIL copying PIL\PaletteFile.py -> build\lib.win32-2.7\PIL copying PIL\PalmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PcdImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PcfFontFile.py -> build\lib.win32-2.7\PIL copying PIL\PcxImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PdfImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PixarImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PngImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PpmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PsdImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\PSDraw.py -> build\lib.win32-2.7\PIL copying PIL\PyAccess.py -> build\lib.win32-2.7\PIL copying PIL\SgiImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\SpiderImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\SunImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\TarIO.py -> build\lib.win32-2.7\PIL copying PIL\TgaImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\TiffImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\TiffTags.py -> build\lib.win32-2.7\PIL copying PIL\WalImageFile.py -> build\lib.win32-2.7\PIL copying PIL\WebPImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\WmfImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\XbmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\XpmImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL\XVThumbImagePlugin.py -> build\lib.win32-2.7\PIL copying PIL_binary.py -> build\lib.win32-2.7\PIL copying PIL_tkinter_finder.py -> build\lib.win32-2.7\PIL copying PIL_util.py -> build\lib.win32-2.7\PIL copying PIL__init__.py -> build\lib.win32-2.7\PIL running egg_info writing requirements to Pillow.egg-info\requires.txt writing Pillow.egg-info\PKG-INFO
writing top-level names to Pillow.egg-info\top_level.txt writing dependency_links to Pillow.egg-info\dependency_links.txt warning: manifest_maker: standard file '-c' not foundreading manifest file 'Pillow.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no files found matching
'.sh' no previously-included directories found matching 'docs_static' warning: no previously-included files found matching '.coveragerc' warning: no previously-included files found matching '.editorconfig' warning: no previously-included files found matching '.landscape.yaml' warning: no previously-included files found matching '.travis' warning: no previously-included files found matching '.travis*' warning: no previously-included files found matching 'appveyor.yml' warning: no previously-included files found matching 'build_children.sh' warning: no previously-included files found matching 'tox.ini' warning: no previously-included files matching '.git' found anywhere in distribution warning: no previously-included files matching '.pyc' found anywhere in distribution warning: no previously-included files matching '.so' found anywhere in distribution writing manifest file 'Pillow.egg-info\SOURCES.txt' running build_ext
The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html Traceback (most recent call last): File "<string>", line 1, in <module> File "D:\home\site\wwwroot\env\build\pillow\setup.py", line 756, in <module> raise RequiredDependencyException(msg) __main__.RequiredDependencyException: The headers or library files could not be found for zlib, a required dependency when compiling Pillow from source. Please see the install instructions at: https://pillow.readthedocs.io/en/latest/installation.html ---------------------------------------- Cleaning up... .................................................... Command
D:\home\site\wwwroot\env\Scripts\python.exe -c "import setuptools, tokenize;file='D:\home\site\wwwroot\env\build\pillow\setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), file, 'exec'))" install --record d:\local\temp\pip-nu1mtm-record\install-record.txt --single-version-externally-managed --compile --install-headers D:\home\site\wwwroot\env\include\site\python2.7 failed with error code 1 in D:\home\site\wwwroot\env\build\pillow Storing debug log for failure in D:\home\pip\pip.log An error has occurred during web site deployment. Error - Changes committed to remote repository but deployment to website failed.
谢谢
您的 pip 太旧,无法下载 whl(Python 默认版本的已知问题)。请更新您的 Python 安装或直接更新 pip: https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/
您似乎正在使用 Azure Web Apps/App 服务来部署包含 Pillow
包的 Django 应用程序,并且 Pillow
包似乎是您在 requirements.txt
喜欢 Pillow>=2.0.0
.
但是,不幸的是,在 Azure 应用服务上使用 Pillow
包存在两个问题。
Pillow 包含将应用程序部署到 Azure 时需要编译的 C 代码。解决方法是需要自己构建一个Pillow的wheel文件添加到你的项目中,并在
requirements.txt
中声明wheel文件,具体请参考Azure官方Django教程Troubleshooting - Package Installation部分了解它.Pillow 作为 Python 的图像库需要 GDI API 和资源。在 Azure 应用服务上,任何 GDI 调用都受到限制和阻止,请参阅 here 了解。
所以部署 Django 应用程序的唯一方法是使用 Azure VM。