Installation of python2 under Linux Ubuntu system
The installation typing commands and errors are as follows:
Background: The official has announced to stop the update and service of Python 2 a long time ago, so for versions after ubuntu20, python3 is installed, but when we are dealing with the installation of some large-scale scientific computing programs , often need to use some old libraries and programs. Here, cif2cell installed by python2 is taken as an example. Its main function is to convert the crystal structure modeling file of cif into a structural coordinate file that can be recognized by the scientific computing program SPRKKR. Regarding the error of installing python2, I tried many methods but it didn't work:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install python2.7
结果:Unable to Locate package
sudo apt update
sudo apt upgrade
sudo apt install python2
Result: Unable to Locate package
At the same time, I tried to replace various sources (Ali source and Tsinghua source still have the same error).
However, we often ignore the background of the official stop of the update service, so the key problem still occurs In terms of source selection and loading, the correct solution is as follows:
enable the universe source repository:
sudo add-apt-repository universe
Update source, and install:
sudo apt update
sudo apt install python2
Check if the installation was successful:
python2 --version
At this time, the terminal will return the version number of py2, and the installation is successful!
cif2cell installation
Next, we use py2 to install the cif2cell program. cif2cell requires the system to have Python 2, and the setup.py installation script is not compatible with Python 3!
First download the cif2cell program package, the URL is as follows:
https://sourceforge.net/projects/cif2cell/
After the download is complete, select a directory, put the compressed package in it, and unzip it:
tar -zxvf cif2cell-1.2.10.tar.gz
cd cif2cell-1.2.10/
Unzip the attached PyCIFRW package in the current directory
tar -zxvf PyCifRW-3.3.tar.gz
After the py2 installation is complete, install cif2cell:
python2.7 --version
sudo python2.7 setup.py install
View version number
cif2cell -V
Test transform structure file function: