Last update at :2024-02-06,Edit by888u
Today when I was tossing around with the pyone program, I found that the python version of centos chick was 2.6.6, which did not meet the requirements and needed to install 2.7. I looked it up on the Internet and found the tutorial. After a while, some problems appeared. The problem was finally solved. Let me share the solution process below.
1. Check the current python version
#python -V Python 2.6.62. Download Python-2.7.11
wget https://www.python.org/ftp/python/2.7.11/Python-2.7.11.tgz3. Unzip and enter the directory
tar zxvf Python-2.7.11.tgz cdPython-2.7.114. Compile and install
./configure make all make install make clean makedisclean5. View the installed version
/usr/local/bin/python2.7 -V Python 2.7.116. Establish a soft connection so that the system's default python points to python2.7
mv /usr/bin/python /usr/bin/python2.6.6 ln -s /usr/local/bin/python2.7 /usr/bin/python python -V Python 2.7.117. After solving the problem that the system Python soft link points to the Python2.7 version, because yum is not compatible with Python 2.7, yum cannot work properly. We need to specify the Python version of yum. Those who do not know VI editing commands can use Pagoda. File management to change.
#vi /usr/bin/yumChange the header of the file
#!/usr/bin/python Change to #!/usr/bin/python2.6.68. Configure iBus
Use vim to open the following two files respectively, find the exec python line, change exec python to exec python2.6, save and exit. iBus returned to normal after restarting!
#vim /usr/bin/ibus-setup #vim /usr/libexec/ibus-ui-gtk9. After completing the above tutorial, another error occurred when executing pip install -r requirements.txt.
Traceback (most recent call last): File "/usr/bin/pip", line 7, in from pip import main ImportError: No module named pipSolution, find the installation path of pip in Python2.6:
find /usr -name pipYou can see the path:
/usr/lib/python2.6/site-packages/pip /usr/bin/pipJust copy the pip file to python2.7/site-packages. The directory is as follows:
/usr/local/lib/python2.7/site-packagesRecommended site searches: domain name registration information query, Hong Kong host, Hong Kong server rental, cn domain name, registration-free jsp space, Taiwan proxy server, asp free space application, mainland China registration-free host, US anti-attack server, domain name space,
发表评论