Install the SDK Package
Environment preparation
- Runtime environment
The Python SDK supports running in Python 2.7 and Python 3.x environments. - Install pycrypto dependency
Before installing the SDK, execute the commandpip install pycryptoto install pycrypto dependency.
If installation fails, executepip install pycryptodome.
Download and installation
Method 1: Install via pip
You can install the Baidu AI Cloud Python SDK into your environment using the pip installation method. While connected to the internet, 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 2: 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):
Plain Text1pip install bce-python-sdk-version.zip
You can then install the Python SDK to your local device.
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
2python setup.py install
Complete the SDK installation process.
SDK directory structure
1baidubce
2 ├── auth //Public permission directory
3 ├── http //Http request module
4 ├── retry //Http request module
5 ├── services //Service public directory
6 │ └── et //ET directory
7 │ ├──__init__.py //Empty
8 │ ├──et_client.py //ET client entry class
9 ├── __init__ //Partial constants for BCE client
10 ├── bce_base_client.py //Base class for BCE client entry points
11 ├── bce_client_configuration.py //General configuration class for BCE client
12 ├── bce_response.py //Request class for BCE client
13 ├── exception.py //BCE client exception class
14 ├── compact.py //String compatibility class for PY2, PY3{-1-}
15 ├── protocol.py //Network protocol definition
16 ├── region.py //Region processing module
17 └── utils.py //BCE common utilities
18
Uninstall SDK
Use pip to uninstall "bce-python-sdk" as intended.
