SDK Installation
Environmental Preparation
1.Runtime environment
Python SDK supports running in environment of Python2.7 and Python3.x
2.Install pycrypto reliance
Before installing SDK, it is needed to execute command pip install pycrypto
first to install pycrypto reliance.
If the installation fails, please execute pip install pycryptodome
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
├── services //Service public directory
│ └── bos //BOS directory
│ ├──bos_client.py //BOS client entry class
│ ├──bos_handle.py //HTTP reponse manipulation function
│ ├──canned_acl.py //Constant required for permission control
│ └──storage_class.py //Store type definition module
├── bce_base_client.py //Base class of BCE client entry class
├── bce_client_configuration.py //Configuration for BOS-specific HttpClient
├── bce_response.py //Request class of BCE client
├── exception.py //Exception class of BCE's client
├── protocol.py //Network protocol definition
├── region.py //Region processing module
├── retry_policy.py //Public configuration class of BCE service
└── 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.