在 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.txt
with 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.
相关文章