0

I install a python2.7.6 locally, and there is another 2.7.6 installed on cluster publicly.

Then I use my local python to install a pip but when I 'pip list', it returns:

$ pip list Traceback (most recent call last): File "/home/zengh/.local/bin/pip", line 7, in from pip import main File "/home/zengh/.local/lib/python2.7/site-packages/pip/init.py", line 13, in from pip.utils import get_installed_distributions, get_prog File "/home/zengh/.local/lib/python2.7/site-packages/pip/utils/init.py", line 5, in import locale File "/home/software/rhel6/python/2.7.6/lib/python2.7/locale.py", line 18, in import operator ImportError: /home/software/rhel6/python/2.7.6/lib/python2.7/lib-dynload/operator.so: undefined symbol: _PyUnicodeUCS2_AsDefaultEncodedString

Obviously it calls the locale.py on the cluster while my PYTHONPATH only contains my local python's path. How can I make it call the

/.local/python2.7.6/lib/python2.7/locale.py?

Thanks

3
  • How did your get your local python installed? Commented Jul 19, 2015 at 6:23
  • The solution might also be: Do not install a second Python2.7. What for did you install a second Python2.7? Maybe there is an other solution to your original problem. Commented Jul 19, 2015 at 7:45
  • It is because 'undefined symbol: PyUnicodeUCS4_Decode' appeared when I run the python from original python on the cluster. So I install it as /configure --prefix=/home/username/.local/python2.7.6 --enable-shared -enable-unicode=ucs4 $make;make install Commented Jul 19, 2015 at 12:43

1 Answer 1

1

Depends on whether you want to set it from within a script or from os.

From script:

    import sys
    sys.path.append('additional dir')

From os:

    export PYTHONPATH=somewhere
Sign up to request clarification or add additional context in comments.

1 Comment

Hi mstuebner, this dosen't work to me. I've already use [from os] to set PYTHONPATH includes local python path and excludes public python path. But pip/utils/_init_.py will still call the locale.py on the cluster. Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.