SDK Installation
Environmental Preparation
- Runtime environment
Python SDK supports running in environment of Python2.7 and Python3.x 3.Install pycrypto reliance
Before installing SDK, it is needed to execute commandpip install pycrypto
first to install pycrypto reliance.
Download and Install
Method 1: Install via pip
You can install the Baidu AI Cloud Python SDK into your environment through pip installation. Execute the following command on the command line in the networked state:
pip install bce-python-sdk
You can install the Python SDK locally.
Method 2: Download the source package locally and install it
1.Download the Python SDK compressed toolkit at Developer Resource Center.
2.Move the command line to the path of the compressed package and execute the following command (version is replaced with the version number in the package name):
pip install bce-python-sdk-version.zip
You can install the Python SDK locally.
You can also execute the following command after decompressing the compressed package (version is replaced with the version number in the package name)
cd bce-python-sdk-version
python setup.py install
to complete the SDK installation.
SDK's Directory Structure
baidubce
├── auth //Public permission directory
├── http //Http request module
├── retry //Http request module
├── services //Service public directory
│ └── vpc //VPC directory
│ ├──__init__.py //Null
│ ├──acl_client.py //ACL's client entry class
│ ├──nat_client.py //NAT's client entry class
│ ├──nat_model.py //Providing the NAT client with the Billing Model.
│ ├──peerconn_client.py //PEERCONN's client entry class
│ ├──peerconn_model.py //Providing the PEERCONN client with the Billing Model.
│ └──vpc_client.py //VPC's client entry class
│ └── subnet //SUBNET directory
│ ├──__init__.py //Null
│ └──subnet_client.py //SUBNET's client entry class
│ └── route //ROUTE directory
│ ├──__init__.py //Null
│ └──route_client.py //ROUTE's client entry class
├── __init__ //Some constants of the BCE client
├── bce_base_client.py //Base class of BCE client entry class
├── bce_client_configuration.py //General configuration class of the BCE client
├── bce_response.py //Request class of BCE client
├── exception.py //Exception class of BCE's client
├── compact.py //String compatible class of PY2 and PY3
├── protocol.py //Network protocol definition
├── region.py //Region processing module
└── utils.py //BCE's utility tool class
Uninstall SDK
It is expected that you can uninstall "bce-python-sdk" using pip when uninstalling the SDK.