Yuseferi
Yuseferi

Reputation: 8710

How to install a specific version of a package with pip

I want to install Pyquery 1.2.4 version, but when I try

 pip install pyquery==1.2.4

I face with

  Compile failed: command 'gcc' failed with exit status 1
    creating tmp
    cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitXZJM6c.c -o tmp/xmlXPathInitXZJM6c.o
    /tmp/xmlXPathInitXZJM6c.c:1:26: error: libxml/xpath.h: No such file or directory
    *********************************************************************************
    Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
    *********************************************************************************
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-cmQUrb/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-YFpKDF-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-cmQUrb/lxml

    No matching distribution found for python-pyquery

I know it because my Python version (2.6), and I can't update it to 2.7 because of yum

How can I resolve this problem?

Upvotes: 1

Views: 6124

Answers (3)

user5549921
user5549921

Reputation:

You may possibly be missing XML dependencies which your GCC compiler is spitting out at you, which can be installed with the following:

yum install libxslt-devel libxml2-devel libxml2 libxslt

After installing each the development and release dependencies, try:

pip install pyquery==1.2.4

Which should successfully execute. You should be also able to update Python with the following method: here. (Probably depends on your OS version.)

The above method explains:

yum install -y centos-release-SCL 
yum install -y python27

Okay for centos 6.4 also On apu.0xdata.loc, after this install was done

$ which python 
/usr/local/bin/python

$ python -V
Python 2.7.3

$ ls -ltr /usr/local/bin/pyth*
lrwxrwxrwx 1 root root      24 Jan 30  2013 /usr/local/bin/python -> /usr/local/bin/python2.7
-rwxr-xr-x 1 root root 6162289 Sep  3 00:59 /usr/local/bin/python2.7
-rwxr-xr-x 1 root root    1624 Sep  3 01:00 /usr/local/bin/python2.7-config

So yum will use '/usr/bin/python' which is 2.6

$ /usr/bin/python -V
Python 2.6.6

"python" will give you python 2.7.

"python2.7" will give you python 2.7.

"easy_install" and "easy_install-2.7" will easy install for python 2.7. While separate files, they both seem to install into /usr/local/lib/python2.7/site-packages/

Upvotes: 3

alex10
alex10

Reputation: 2768

Or try this:

sudo apt install libxml2-dev libxslt1-dev python-dev

Or so:

sudo apt install python-pyquery

Upvotes: 0

Avihoo Mamka
Avihoo Mamka

Reputation: 4786

You are missing some OS related dependencies.

Try this:

apt-get install libxml2-dev libxslt1-dev python-dev

Upvotes: 1

Related Questions