This topic describes how to install and uninstall Tablestore SDK for Python.
Prepare the environment
Install Python 2 or Python 3 before you install Tablestore SDK for Python.
Install Tablestore SDK for Python
Method 1: Use pip
Run the following command to install Tablestore SDK for Python:
sudo pip install tablestore
Method 2: Use GitHub
Make sure that Git is installed. For more information about how to download Git, visit Git. After Git is installed, run the following commands to install Tablestore SDK for Python:
git clone https://github.com/aliyun/aliyun-tablestore-python-sdk.git sudo python setup.py install
Method 3: Use source code
Download the SDK package.
Decompress the SDK package. Then, run the following command to install Tablestore SDK for Python:
sudo python setup.py install
Some Protocol Buffers (Protobuf) versions are incompatible with the *pb2.py
files in the current installation package. You can manually generate *pb2.py
files to fix this issue. To manually generate *pb2.py files, perform the following steps:
Use the current version of Protobuf to generate the code of the corresponding Protobuf files.
protoc --python_out=. tablestore/protobuf/search.proto protoc --python_out=. tablestore/protobuf/table_store.proto protoc --python_out=. tablestore/protobuf/table_store_filter.proto
Change the .proto suffix of the three generated files to
pb2.py
and copy the files to thetablestore/protobuf/
directory in the installation directory to replace the existing*pb2.py
files.
Verify Tablestore SDK for Python
Enter python on the CLI and press the Enter key. Then, run the following command to check the SDK version in the Python environment:
>>> import tablestore
>>> tablestore.__version__
'5.3.0'
Uninstall Tablestore SDK for Python
To uninstall Tablestore SDK for Python, run the following pip command:
sudo pip uninstall tablestore