PyODPS is MaxCompute SDK for Python. PyODPS provides the DataFrame framework and basic operations on MaxCompute objects to help you analyze data in MaxCompute by using Python. You can use PyODPS in DataWorks or an on-premises environment. This topic describes how to install PyODPS when you use PyODPS in an on-premises environment.
The version of Python meets requirements. We recommend that you use Python 3.6 or later. Python 2.7 or earlier is not recommended.
- Run the following command to install PyODPS:
pip install pyodps
- Run the following command to check whether the installation is successful:
python -c "from odps import ODPS"
- If the Python version is not the default, you can run the following command to switch to the default version after you have installed pip:
/home/tops/bin/python3.7 -m pip install setuptools>=3.0 # /home/tops/bin/python3.7 is the directory in which Python is installed.
What to do next
- We recommend that you install greenlet 0.4.10 or later to accelerate Tunnel-based data upload.
- Initialize the MaxCompute entry point.
from odps import ODPS o = ODPS('your-access-id', 'your-secret-access-key', 'your-default-project',endpoint='your-end-point')
- your-access-id and your-secret-access-key: Replace them with the AccessKey ID and AccessKey secret of your Alibaba Cloud account.
- your-default-project and your-end-point: Replace them with the default project name and endpoint. For more information about the endpoints of each region, see Endpoints.
delete. For more information about how to use PyODPS, see Overview and Overview.
Note Unless otherwise specified, the o object in this topic is a MaxCompute object.