In order to test the Mesos, a centos7.1 was made, using a minimal installation, and then installing the Net-tools, the "Development tools" set. Later I wanted to install the DCOs CLI tool and found that the Python pip was not available.
Search, found Centos7 automatic version of Python is 2.7.5, without OpenSSL encryption, and to download things are HTTPS, looking for a long time, hoping to let Pip ignore https verification without fruit. A message was found, said to be 2.7. More than 9 version comes with the OpenSSL plugin. All right, let's try this!
1, install a bunch of required packages, the reason for two days, is completely these pits, a step a pit Ah!
Yum-y install OpenSSL openssl-devel ncurses-devel.x86_64 bzip2-devel sqlite-devel python-devel zlib
2, download python2.7.10 source package, extract to a temporary directory, I put in/tmp under the
wget https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tgz
Tar zxvf python-2.7.10.tgz
3. Compiling
Before compiling, note that configure should use "--enable-shared" to generate a dynamic link library. (otherwise compile MOD_WSGI error) Only use this item is not enough, start using only the--enable-shared option, found that after the compilation is complete, go to the Python2.7.10 directory, execute python, Python2, python2.7 is the prompt that returns python2.7.5 at the terminal. Therefore, when executing the Configure command, also add the "-rpath" option, this represents whether to install the generated library in the installation directory of the software, by default, in the installation directory, otherwise specify the path.
Create a directory first, or you will get an error after configure:
Mkdir-p/usr/local/python/2.7.10/lib
./configure--enable-shared--prefix=/usr/local/python/2.7.10 ldflags= "-wl,-rpath/usr/local/python/2.7.10/lib"
Make && do install && make clean
4. Switch to the new version
Here must keep the original python2.7.5, I began to be directly covered by the old version, the results found that Yum can not be used, the cost of countless efforts, also did not fix, had to re-installed the system, anyway is the test of the virtual machine (but the next day to find the way to repair)
mv/usr/bin/python/usr/bin/python2.7.5
Ln-fs/usr/local/python/2.7.10/bin/python2.7/usr/bin/python
5. Solving the Yum problem
Because Yum needs to use the Python2.7.5 version, Yum should not be able to work now, and Yum-related files will be set up so that the Yum-related commands do not go wrong. Vi/usr/bin/yum, modify the first sentence and replace it with the reserved 2.7.5 version:
!/usr/bin/python2.7.5
See a lot of people said to change the above is all right, I modified the above, Yum is still a problem, and then according to the part of the problem modified the "/usr/libexec/urlgrabber-ext-down" under the first sentence:
!/usr/bin/python2.7.5
The familiar Yum interface comes out!
5, install Setuptools, pip
The old version of these, can not take effect, you have to re-installed, I met a lot of holes in this, chrysanthemum residue, covered with wounds Ah!
Download ez_setup.py file, install Setuptools:
wget https://bootstrap.pypa.io/ez_setup.py
Run the following command to install, because the following command did not execute successfully, no way, Yum installs Zlib-devel, and then zlib-devel the new Python.
Python ez_setup.py
Download pip source code, enter the source directory to install, this step also because the first step of the related components did not install, pit for half a day
wget https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz#md5=3823d2343d9f3aaab21cf9c917710196
Tar zxvf python-2.7.10.tgz
CD Python-2.7.10
Python setup.py Install
Adding a soft link, this step seems not very necessary:
Ln-fs/usr/local/python/2.7.10/bin/pip/usr/bin/pip
I thought this would be all right, the result of running PIP, the direct error, but also because the dependent components are not installed.
Finally, it is better to add the new Python path to the PATH environment variable, otherwise other components will not run properly.
Compiling Python2.7.10