Install Python Packages in Azure ML?

前端 未结 3 1209
Happy的楠姐
Happy的楠姐 2020-12-18 08:12

Similar question as here but now on Python packages. Currently, the CVXPY is missing in Azure ML. I am also trying to get other solvers such as GLPK, CLP and COINMP working

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-18 09:01

    Or just use something like this

    import pip
    
    # you can make this install from a local path if needed, and upload the binaries
    def install(package):
        if hasattr(pip, 'main'):
            pip.main(['install', package])
        else:
            pip._internal.main(['install', package])
    
    if __name__ == '__main__':
        try:
            import mymodule
        except:
            install('mymodule')
    

    Installing python module within code

提交回复
热议问题