The pit caused by the Python upgrade

Source: Internet
Author: User
Tags install openssl

Source of the problem

The problem is always like this suddenly, let me unprepared.

The child is not a mother long story ah, the operating system is centos6.5 so the default comes with Python is 2.6.6, suddenly one day I want to write a Kafka topic consumption situation monitoring, so I need to install a package, unfortunately, This package requires very special needs python2.7, no recruit can only upgrade, upgrade relatively simple online search a large heap, upgrade complete monitoring also smooth development completed, all so peaceful past a long time. All of a sudden, my colleague came to me today to say that one of the UDF functions he had written to Hive was not available, saying that the package was missing: pyhs2, and said that before the package was loaded, why not use it, I said it should be I upgraded Python to 2.7 caused by it, I said I give you a bar, direct pip simple very ah, colleague said you do it I went home, the result of my tragedy Began.

Problem 1:PIP Installation

After the upgrade is complete, I did not install pip, the next package to install a bar, began to Error.

1. ImportError: Nomodule named setuptools 解决方案

Download SETUPTOOLS-0.6C11

2. Install Setuptools error runtimeerror:compression requires the (missing) zlib module

Follow the prompts to install zlib and Zlib-devel direct Yum installation, but need to rebuild and install 2.7 python

Method: go to python2.7 's installation package before make install, before you do the changes of the ln-s do not need to change, still can use.

The 3.setuptools smooth installation is complete and the PIP installation is completed successfully.

Problem 2:pip point to the 2.6 version of the issue

1. Because the previous time in the python2.6 with PIP installed PYHS2 so when the package is installed, the package will be installed, but you go to the python2.7 environment, the import will still report the problem of not finding the package .

Cause: the link to the PIP is python2.6 by executing the pip-v command, so the package you installed earlier prompts you to install it.

Question:importerror: No module named pkg_resources

Workaround: 1. Uninstall the current PIP from the new Installation reference article Http://linuxsogood.org/816.html. Both of these problems can be solved.

Workaround: 2. Keep the previous pip, because another user will need to 2.6.6 environment, find the python2.7 in the PIP package, install the package again

Execute: Whereis pip, Find the current PIP path

execution:/usr/local/bin/pip2.7 Install pyhs2.

Issue 3: error when installing PYHS2

Error question:importerror:cannot import name Httpshandle

Workaround: lack of problems caused by OpenSSL and openssl-devel. Direct Yum install, but need to rebuild and install 2.7 of Python

Yum Install OpenSSL Openssl-devel

Method: go to python2.7 's installation package before make install, before you do the changes of the ln-s do not need to change, still can use.

Then install PYHS2 again.

The pit caused by the Python upgrade

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.