简体   繁体   English

如何使用virtualenv将Python函数上载到IBM Cloud

[英]How to upload Python function with virtualenv to IBM cloud

I'm trying to add a python function to IBM Cloud. 我正在尝试向IBM Cloud添加python函数。

I use scrapy library and requests, thus following the docs I need to create a .zip file with __main__.py , helpers.py files and virtualenv . 我用scrapy库和要求,因此,继文档我需要创建一个.zip与文件__main__.pyhelpers.py文件和virtualenv

I did it with 我做到了

zip -r test.zip __main__.py helper.py virtualenv

And the zip file is created, but the problem is that the file to big is and I can't upload it to IBM. 并创建了zip文件,但是问题在于文件太大了,我无法将其上传到IBM。 I asked about it here . 在这里问过这个问题

Those two .py files ( __main__.py helper.py ) are very small, thus the problem is in virtualenv . 这两个.py文件( __main__.py helper.py )非常小,因此问题出在virtualenv I need to compress it or do something to decrease the size of it. 我需要压缩它或做一些事情来减小它的大小。

I've created it with: 我用以下方法创建了它:

virtualenv virtualenv

It installed default dependencies. 它安装了默认依赖项。 And I've installed two extra libraries with pip , thus: 而且我用pip安装了两个额外的库,因此:

pip install requests==2.18.4
pip install Scrapy==1.5.0

I need those two. 我需要那两个。

With that virtualenv the created zip file is too big. 使用该virtualenv ,创建的zip文件太大。

I know that that the problem is, because if I create a .zip file without virtualenv it uploads without problems. 我知道这是问题所在,因为如果我创建一个virtualenv.zip文件时,它的上传不会出现问题。

Thus is there any way to decrease the size or to solve my problem and to be able to upload it to IBM? 因此,有什么方法可以减小大小或解决我的问题并将其上传到IBM?

I assume your file size is still below the actual 48MB limit, right? 我认为您的文件大小仍低于实际的48MB限制,对吗?

If so, we are still working on fixing this so that files - even zip files - smaller than 48MB can be uploaded again as I gave explained here: IBM Cloud functions - Unable to create an action 如果是这样,我们仍在努力解决这个问题,以便小于48MB的文件-甚至zip文件-可以再次上传,如下文所述: IBM Cloud函数-无法创建操作

I will def. 我会的。 let you know once we have the fix in place. 修复后,请告知您。

Besides that, you have tried to upload your dependencies to Dockerhub uploading only the actual action code to IBM Cloud Functions as explained here: http://jamesthom.as/blog/2017/08/04/large-applications-on-openwhisk/ 除此之外,您还尝试将依赖项上载到Dockerhub,仅将实际操作代码上载到IBM Cloud Functions,如下所述: http : //jamesthom.as/blog/2017/08/04/large-applications-on-openwhisk/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用Python将virtualenv添加到IBM Cloud - How to add virtualenv to IBM cloud with Python 将当前 URL 参数传递给 Cloud Function Python ZDB974238714CA8DE634A7CE1D08 上 Cloud - Pass current URL parameters to Cloud Function Python API on IBM Cloud IBM云功能 - 如何使用和上传自己的库? - IBM Cloud Functions - How to use and upload own libraries? 如何导入 Cloudant 模块以通过 IBM 云服务器少功能 python 3.9 操作来操作现有文档? - How to import Cloudant module to manipulate existing documents via IBM cloud server less function python 3.9 actions? 如何将 IBM cloudant 数据库连接到 IBM 云(云基础设施)上的 python 应用程序代码? - how to connect IBM cloudant database to python app code already on IBM cloud(cloud foundary)? IBM Cloud Functions Python API 打开本地文件浏览器上传文件 - IBM Cloud Functions Python API to open a local file browser to upload file 如何在Python Flask中从IBM Cloud App ID注销/注销 - How to logout / signout from IBM Cloud App ID in Python Flask 如何将python打包到virtualenv中? - How to package python into virtualenv? 如何在virtualenv中使用python 2和3 - How to have python 2 and 3 in virtualenv 如何使用 Python 3 创建 Virtualenv? - How to create a Virtualenv with Python 3?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM