Install the SDK Package
Environment preparation
-
Runtime environment
The Python SDK supports Python 2.7 and all Python 3.x versions.
-
Install pycrypto dependency
Before installing the SDK, execute the command
pip install pycryptoto install pycrypto dependency.
If installation fails, executepip install pycryptodome -
Check the currently used SDK version
import baidubce
print(baidubce.SDK_VERSION)
Download and installation
Method I: Install via pip
You can install Baidu AI Cloud Python SDK into your environment via pip installation method. When connected to the network, execute the following command in the command line:
1pip install bce-python-sdk
You can now install the Python SDK to your local machine.
Method II: Download the source package locally for installation
- Download the Python SDk compression toolkit from Developer Resource Center.
-
Navigate the command line to the path where the compressed package is located, and execute the following command (replace version with the version number in the package name):
pip install bce-python-sdk-version.zip
You can now install the Python SDK to your local machine.
Alternatively, after decompressing the compressed package, you can execute the following command (replace version with the version number in the package name).
1cd bce-python-sdk-version
2
3python setup.py install
Complete the SDK installation process.
SDK directory structure
1 baidubce
2 ├── auth //Public permission directory
3 ├── http //Http request module
4 ├── services //Service public directory
5 │ └── bos //BOS main directory
6 │ ├──bos_client.py //BOS client entry class
7 │ ├──bos_handle.py //HTTP response handling function
8 │ ├──canned_acl.py //constants required for permission control
9 │ └──storage_class.py //module for defining storage types
10 ├── bce_base_client.py //Base class for BCE client entry points
11 ├── bce_client_configuration.py //Configuration for BOS HttpClient
12 ├── bce_response.py //Request class for BCE client
13 ├── exception.py //BCE client exception class
14 ├── protocol.py //Network protocol definition
15 ├── region.py //Region processing module
16 ├── retry_policy.py //Common Configuration class for BCE service
17 └── utils.py //BCE common utilities
Uninstall SDK
Use pip to uninstall "bce-python-sdk" as intended.
