Use numpy & scipy in Azure web role

后端 未结 2 982
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-06 19:32

I\'m considering using an Azure web site for a Python project with Flask. I already have a test site running with this configuration. I\'m using cPhyton 2.7; IronPhyton is a

2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-06 19:39

    I was able to add Numpy to my Azure Web App site. I believe my method also works for SciPy.

    I am assuming you have a local repository (I am using GIT) and upload it to your Azure site. I am using Django and there is a file called requirements.txt in the base, which I bet is there for Flask also. Each line of this file contains a package that you want added to the installation.

    At first I simply added a line with "Numpy" to it and Azure found a package and tried to install but this failed. So my next attempt I downloaded a "wheel" .whl package from this site:

    http://www.lfd.uci.edu/~gohlke/pythonlibs/

    which includes all dependencies. Download the appropriate file (correct version of Python and 32 or 64 bit which can be chosen on Azure control panel) of the Numpy and SciPy wheel files and stick them into your base directory and add them to your project. Now a line to requirements.txt with just the file name, like this:

    numpy-1.9.2+mkl-cp27-none-win32.whl

    Commit and push to Azure and Voila! everything installs correctly. This also worked for me for the OpenCV wheel package at that site. Good luck!

提交回复
热议问题