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 │ └── vpc //VPC directory
7 │ ├──__init__.py //Empty
8 │ ├──acl_client.py //ACL client entry class
9 │ ├──nat_client.py //NAT client entry class
10 │ ├──nat_model.py //Provide billing model for NAT client
11 │ ├──peerconn_client.py //PEERCONN client entry class
12 │ ├──peerconn_model.py //Provide billing model for PEERCONN client
13 │ └──vpc_client.py //VPC client entry class
14 │ └── subnet //SUBNET directory
15 │ ├──__init__.py //Empty
16 │ └──subnet_client.py //SUBNET client entry class
17 │ └── route //ROUTE directory
18 │ ├──__init__.py //Empty
19 │ └──route_client.py //ROUTE client entry class
20 ├── __init__ //Partial constants for BCE client
21 ├── bce_base_client.py //Base class for BCE client entry points
22 ├── bce_client_configuration.py //General configuration class for BCE client
23 ├── bce_response.py //Request class for BCE client
24 ├── exception.py //BCE client exception class
25 ├── compact.py //String compatibility class for PY2, PY3{-1-}
26 ├── protocol.py //Network protocol definition
27 ├── region.py //Region processing module
28 └── utils.py //BCE common utilities
29
Uninstall SDK
Use pip to uninstall "bce-python-sdk" as intended.
