Python Install (version Problem-method ln-s)

Source: Internet
Author: User

In general, you do not need to install Python yourself. Because Python is already installed by default in most Linux versions, such as Fedora,ubuntu, you can also customize the installation of Python as needed. Use the following code to compile the installation to give an example.

    1. Download the source package . http://www.python.org/getit/

    2. General Overview:
    3. $ TAR–JXVF python-2.5.2.tar.bz2
      $ CD Python-2.5.2
      $./configure
      $ make
      $ make Install
    4. Unzip the installation package. In the directory where the terminal enters the compressed package, enter the command TAR-ZXVF python-2.5.2.tgz (or Bzcat python-2.5.2.tar.bz2 | tar-xf-) To complete the decompression process.
    5. Enter the extracted Python directory, generally first look at the installation instructions Readme, here in detail the Python 2.5.2 related resources and its web site and various supported operating systems under the installation method. The reader can refer to the document appropriately as required. The most common installation process for Python is given below.
    6. ./configure, configure. Here is the most commonly set option is prefix, the default value is/usr/local/lib, set this option to specify the Python installation directory, that is, the./configure--prefix=/home/shengyan/python2.5.2.
    7. Make, compile the source code. If there are no errors to enter the next step, if there are errors, there may be many reasons, such as the current system is missing some of the required programs or some dependencies have not been resolved, so that the step-by-step to find the error until resolved, to compile the correct.
    8. Make install, real installation. Note that if a permission limit is present, it indicates that the current user does not have sufficient privileges to write the Python program document file to a specified directory, such as a system directory such as/usr/local/lib, which requires sudo make install and the password can be entered. Because the prefix is set to the directory under its own user, the direct make install is OK. After a period of waiting, if there is no error, it indicates that Python2.5.2 has been successfully installed.
    9. After a successful installation, the Python directory that was just installed under/home/shengyan/python2.5.2. Enter the/home/shengyan/python2.5.2 directory in the terminal and enter the./python to enter the Python interactive environment where you can see the Python2.5.2 you just installed.
    10. If you want to enter Python directly in the terminal, starting with Python2.5.2 instead of the previous old version, you should do the following two methods:
      • Method One, modify the environment variable path. If you modify path only under terminal, it is only valid for the current terminal. If you want to work in another terminal or after a reboot, you will need to add the export Path=/home/shengyan/python2.5/bin to the end of the. bashrc file in the user directory: $PATH, log off or restart X. There are a number of ways to set the path.

      • Method Two, the above method only sets the current user environment, if you want on the system, the global use of Python2.5.2, you need the following steps: Test
        Entering Python at the command line means that the Python interpreter appears to be installed correctly.
        In Suse10 or Rhel5 (ES5) The system has Python installed by default, but the version is 2.4.x; After this installation, enter in the shell
        #python
        You will find the results shown:
        # python
        Python 2.4.3 (#1, Dec 11 2006, 11:38:52)
        [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
        Type "Help", "copyright", "credits" or "license" for more information.
        >>>
        Version is still 2.4.x.
        Workaround:
        #cd/usr/bin
        #ll |grep python//view Python under this directory
        #rm-RF python
        #ln-S Prefix/python-2.5.2/python./python//prefix to unzip the Python directory for you
        #python

        # python
        Python 2.5.2 (#1, Dec 11 2006, 11:38:52)
        [GCC 4.1.1 20061130 (Red Hat 4.1.1-43)] on linux2
        Type "Help", "copyright", "credits" or "license" for more information.
        >>>
        Ok! Problem Solving!

Python Install (version Problem-method ln-s)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.