在 Azure WebApp 中使用 PIP

2023-10-20Python开发问题
4

本文介绍了在 Azure WebApp 中使用 PIP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我是 Azure 的新手,我正在尝试启动并运行 Django WebApp.我使用 FTP 上传了文件,但 Azure 没有运行我的 requirements.txt.

于是搜索了一下,发现可以用pip安装requirements.txt.

回到 Azure,PIP 似乎不起作用.不在控制台、KUDU CMD 或 KUDU powershell 中.Python 确实有效.
当我尝试通过 Python 安装 PIP 时,它首先说已经安装了旧版本.当 Python 尝试升级 PIP 时,它无权访问它需要编辑的文件夹.

我想知道如何在 azure 中使用 PIP.
(如果你知道安装 requirements.txt 的单独方法,请告诉我,因为我最初就是这样来的.)

I'm pretty new to Azure and I'm trying to get a Django WebApp up and running. I uploaded the files using FTP, But Azure doesn't run my requirements.txt.

So I searched for a bit and found out that you can install the requirements.txtwith pip.

Back in Azure, PIP doesn't seem to work. Neither in the Console, The KUDU CMD or the KUDU powershell. Python does work.
When I try to install PIP via Python, it first says that a older version is already installed. When Python tries to upgrade PIP, it doesn't have access to the folder that it needs to edit.

I was wondering how I could use PIP in azure.
(If you know a seperate way to install the requirements.txt please tell, because this was how I originally came to this point.)

推荐答案

您将无法升级 Django webapp 的 pip,因为您将无法访问系统文件.

You won't be able to upgrade the pip of your Django webapp because you will not have access to system files.

相反,您可以升级您的 virtualenv 的 pip,您可以通过在 install requirements.txt 命令之前在 deploy.cmd 文件中添加一行来完成.

Instead you can upgrade pip of your virtualenv, which you can do by adding a line in deploy.cmd file before install requirements.txt command.

envscriptspython -m pip install --upgrade pip

记住不要用 pip (env/scripts/pip) 升级 pip,否则它将卸载全局 pip.

Remember not to upgrade pip with pip (env/scripts/pip) else it will uninstall global pip.

这篇关于在 Azure WebApp 中使用 PIP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

在xarray中按单个维度的多个坐标分组
groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)...
2024-08-22 Python开发问题
15

Pandas中的GROUP BY AND SUM不丢失列
Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)...
2024-08-22 Python开发问题
17

GROUP BY+新列+基于条件的前一行抓取值
Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)...
2024-08-22 Python开发问题
18

PANDA中的Groupby算法和插值算法
Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)...
2024-08-22 Python开发问题
11

PANAS-基于列对行进行分组,并将NaN替换为非空值
Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)...
2024-08-22 Python开发问题
10

按10分钟间隔对 pandas 数据帧进行分组
Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)...
2024-08-22 Python开发问题
11