1Python learning CentOS 7 Linux environment to build

Given python3 and has become a popular trend, and various Linux distributions still comes python2.x, I try in centos7, deployment Python3.x coexist with the 2.x environment

Reference herein bloggers good brother 95 URL https://blog.csdn.net/qq_39091354/article/details/86584046 content.

Target: Python3.x mounted at centos7, and coexist with 2.x.

 

1. Open URL: https: //www.python.org/ftp/python/, find the version of Python3.X they need to find tgz files in that version.

  For example: Python-3.7.2.tgz

2. Right-copy the download link to the file, open a shell terminal. Use the following command.

  Download your copy of wget link

  for example:

  wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz

3. Unzip the file

  tar zxvf downloaded file name

  , for example:

  tar zxvf Python - 3.7.2.tgz

4. installation environment
  yum -y install zlib-devel bzip2- devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc libffi-devel the make automake autoconf libtool libffi GCC-devel


5. The folder contents into the Python

  cd extract the folder name

  example:

  cd Python-3.7.2

6. The initial configuration

  ./configure --prefix = / usr / local / to python3

7. The mounting

  && the install the make the make

8. The flexible connector disposed

      ln -s / usr / local / python3 / bin / python ( your installed version number) / usr / bin / to python3
      LN -s / usr / local / to python3 / bin / PIP3 / usr / bin / pip3

  example:

      LN /usr/local/python3/bin/python3.7 -s / usr / bin / to python3
      LN -s / usr / local / to python3 / bin / pip3 / usr / bin / pip3

9. The validation is successful

  python3 -V

  returned information is the version you have installed. For example, I returned information is:

  Python 3.7.2

  if successful return, indicating that the installation was successful python3

  verify pip3

  pip3 -V

  successful installation of version information pip3 will return, such as my

  pip 18.1 from /etc/python/python3.7/lib /python3.7/site-packages/pip (python 3.7)
  At this point, a complete success.

  Optional content: Upgrade pip3

  execute the command:

  pip3 install --upgrade PIP
         to speed up the progress of the installation, can be installed into a domestic source, execute the following command:

   pip3 install --upgrade pip   -i  https://pypi.tuna.tsinghua.edu.cn/simple

 Problem Record

         After the author after the deployment is complete, the prompt to update to the latest version pip, pip run the update command appears, it had been prompted to update, but did not actually view the version or update succeeded

         Error message similar to "Requirement already up-to-date ...", then a bold attempt to pip-18.0.dist-infothe delete the directory, continue to re-update pip in a virtual environment, finally succeeded! .

        The key point is that the best execution pip update the desktop environment of the terminal in the virtual machine, rather than using ssh to connect remotely to perform, otherwise prone to failure, the reason is not clear!

 

Guess you like

Origin www.cnblogs.com/skyfly886/p/12329402.html