【问题标题】:Getting Dependency Issues while deploying Python Flask Web API to Azure Portal将 Python Flask Web API 部署到 Azure 门户时出现依赖问题
【发布时间】:2018-11-27 13:02:47
【问题描述】:

我正在尝试将 python flask web api 部署到 azure 门户,但遇到依赖项安装问题,如下图所示。

我已经将扩展 -Python 3.5.4 x64 添加到我的 azure Web 应用程序中,并且还为所有依赖项使用了最新版本,如您在 requirements.txt 文件中所见。

有人可以帮忙吗?

我也尝试过从 Azure Kudu DebugConsole 安装/升级 setuptools,但这会导致访问被拒绝问题。

Kudu Remote Execution Console
Type 'exit' then hit 'enter' to get a new CMD process.
Type 'cls' to clear the console

Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

D:\home>pip install -U setuptools
'pip' is not recognized as an internal or external command,
operable program or batch file.

D:\home>python -m pip install -U setuptools
Downloading/unpacking setuptools from https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl#sha256=88ee6bcd5decec9bd902252e02e641851d785c6e5e75677d2744a9d13fed0b0a
Installing collected packages: setuptools
  Found existing installation: setuptools 2.1
    Uninstalling setuptools:
Cleaning up...
Exception:

Traceback (most recent call last):
  File "D:\Python34\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "D:\Python34\lib\site-packages\pip\commands\install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "D:\Python34\lib\site-packages\pip\req.py", line 1431, in install
    requirement.uninstall(auto_confirm=True)
  File "D:\Python34\lib\site-packages\pip\req.py", line 598, in uninstall
    paths_to_remove.remove(auto_confirm)
  File "D:\Python34\lib\site-packages\pip\req.py", line 1836, in remove
    renames(path, new_path)
  File "D:\Python34\lib\site-packages\pip\util.py", line 295, in renames
    shutil.move(old, new)
  File "D:\Python34\lib\shutil.py", line 535, in move
    os.unlink(src)
PermissionError: [WinError 5] Access is denied: 'd:\\python34\\lib\\site-packages\\__pycache__\\easy_install.cpython-34.pyc'

Storing debug log for failure in D:\home\pip\pip.log

【问题讨论】:

    标签: python pip azure-web-app-service azureportal


    【解决方案1】:

    在 Azure WebApps 上,您无权在路径 D:\ 下执行任何写入操作,D:\home 除外。所以当你想为D:\Python34中的默认python运行时安装pip时,会导致错误PermissionError Access is denied

    唯一的方法是通过 Kudo 安装 Python 站点扩展并配置 web.config 以使用它而不是默认的。现有 SO 线程 Why is the azure app service django deploy keep failing? 的答案介绍了安装,您可以参考解决它。

    现在,我看到你已经安装了这个扩展,但是你调用的 python 命令仍然是默认的。解决方法如下。

    1. 通过命令set PATH=D:\home\Python34;%PATH%更改环境变量path以覆盖默认变量。
    2. 在 Kudo DebugConsole 中更改当前目录并移动到路径D:\home\Python34,然后您可以直接调用python,这是新安装的。

    希望对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-12
      • 2021-12-07
      • 2022-01-23
      • 2018-11-23
      • 2018-08-28
      相关资源
      最近更新 更多