Error: "No module named oss2" when using Python with OSS
This topic may contain community contributions or information about third-party products. For help and support, visit the official websites of the community or third-party products. Third-party products are not covered by Alibaba Cloud support. This topic is for reference only. Alibaba Cloud makes no warranties, express or implied.
Problem description
When you run a Python script to upload or download resources from Object Storage Service (OSS), you receive the error "No module named oss2".
Cause
The Python software development kit (SDK) for OSS and the oss2 module are not installed in your system environment.
Solution
-
Run the following command in your script's environment to install the python3-devel package. This example is for a Linux system.
sudo yum install -y python3-devel -
Run the following command to install the oss2 module.
pip3 install oss2 -
After you install the oss2 module, confirm that your Python script runs correctly.
Applicable to
-
Object Storage Service