QWQyyy commented on PR #1940:
URL: https://github.com/apache/openwhisk/pull/1940#issuecomment-1531122702

   > 允许 zip 文件中的 virtualenv 目录用于 python 操作。
   > 
   > 这允许将使用 pip 安装的 python 模块打包到操作 zip 文件中。 调用者在调用操作之前激活虚拟 python 环境。
   > 
   > 命名约定:
   > 
   > 1. zip 文件中主要 python 模块的名称必须是:`__main__.py`
   > 2. 虚拟环境的目录名必须是:virtualenv
   > 
   > 如何使用虚拟环境创建 zip 文件:
   > 
   > 1. 命名你的python文件  `__main__.py`
   > 2. 安装 virtualenv: (pip install virtualenv)
   > 3. 创建名为“virtualenv”的虚拟环境:virtualenv virtualenv
   > 4. 激活虚拟环境:source virtualenv/bin/activate
   > 5. 安装所有必需的模块(例如 pip install xxx)
   > 6. 停用虚拟环境:deactivate
   > 7. 压缩文件:zip -r myPython.zip virtualenv`__main__.py`
   > 8. 创建操作:wsk action create actionname --kind python myPython.zip
   
   well
   
   
   > Allow a virtualenv directory in a zip file for a python action.
   > 
   > This allows to package python modules installed with pip into the action 
zip file. The invoker activates the virtual python environment before invoking 
the action.
   > 
   > Naming conventions :
   > 
   > 1. The name of the main python module in the zip file must be : 
`__main__.py`
   > 2. The directory name of the virtual environment must be : virtualenv
   > 
   > How to create a zip file with a virtual environment:
   > 
   > 1. name your python file  `__main__.py`
   > 2. install virtualenv:  (pip install virtualenv)
   > 3. create the virtual environment named 'virtualenv': virtualenv virtualenv
   > 4. activate the virtual environment: source virtualenv/bin/activate
   > 5. install all required modules (e.g. pip install xxx)
   > 6. deactivate the virtual environment: deactivate
   > 7. zip the files: zip -r myPython.zip virtualenv `__main__.py`
   > 8. create action: wsk action create actionname --kind python myPython.zip
   
   well notes, this way is work in now days...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to