Thursday, August 25, 2016

Creating a portable Python + VSphere Python SDK for Windows

If you are working with Virtual Center in an enterprise environment, there are high changes that your VC clients are Windows systems running on a secure network (no network access). This article will let you build a portable Python extender the VSphere Python SDK that you can just copy and use from your vcenter client systems.
  

Get the required packages on a system having network access: 

  • lessmsi from https://github.com/activescott/lessmsi/releases/latest 
  • python*.msi from https://www.python.org/downloads/windows/
  • Python packages from pip:
    • six-1.10.0-py2.py3-none-any.whl, 
    • requests-2.10.0-py2.py3-none-any.whl
    • suds-0.4.tar.gz
    • pyvmomi-6.0.0.2016.6.tar.gz 

Create a .bat file that creates the python portable directory:

lessmsi-v1.4\lessmsi x python-2.7.12.amd64.msi python\
cd python\SourceDir
python -m ensurepip
scripts\pip install ../../six-1.10.0-py2.py3-none-any.whl
Scripts\pip install ../../requests-2.10.0-py2.py3-none-any.whl
Scripts\pip install ../../suds-0.4.tar.gz
Scripts\pip install ../../pyvmomi-6.0.0.2016.6.tar.gz

Run it, you will get your portable content in the "python" folder

 

No comments:

Post a Comment