Install the SDK Package
Environment preparation
-
Runtime environment
The Python SDK supports both Python 2.7 and Python 3 environments.
-
Install pycrypto dependency
Before installing the SDK, execute the command
pip install pycryptoto install pycrypto dependency.
If installation fails, executepip install pycryptodome
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
1com.baidubce
2 ├── auth //BCE signature classes
3 ├── http //BCE HTTP communication classes
4 ├── internal // SDK internal classes
5 ├── model // BCE common model classes
6├── services
7 │ └─ bcc //BCC service-related classes
8 │ ├─ model //Internal BCC models, such as Request or Response
9 │ ├─ BccClient.class //BCC client entry class
10 │ └─ BccClientConfiguration.class //Configuration for BCC-specific HttpClient
11 ├── util //BCE common utilities
12 ├── BceClientConfiguration.class // Configuration for BCE HttpClient
13 ├── BceClientException.class // BCE client exception class
14 ├── BceServiceException.class // Exception class after BCE server interaction
15 ├── ErrorCode.class // BCE common error codes
16 └── Region.class // Regions where BCE provides services
Uninstall SDK
Use pip to uninstall "bce-python-sdk" as intended.
