I am currently running Opensuse 13.2, 64 bit version on my computer. By default, on my system both python3.4 and python2.7 were installed(I am not sure whether they were installed because I "patch"ed it.) Normally when I type “python” on commandline python2.7 gets callled. My problem is when I try to make system-wide installation for python using pip, pip’s default installation path seems to be python3.4/site-packages directory, but I don’t want that. Also when typed “pip list”, it seems that packages within python3.4 directory gets displayed but not packages inside python2.7. Besides that, when I install virtualenv and virtualenvwrapper using pip, it causes some problems. For example, virtualenv uses python3.4 by default when a project gets created. Virtualenvwrapper.sh file within /usr/bin directory returns an error since it looks inside python2.7 directory and cannot find anything, but it is actually installed within python3.4.
My question is how can I change pip’s default installation path?
Although I made a lot searches on the web, I could not find a decent answer.
Install python-pip with **zypper in python-pip , **run update-alternatives --config pip and choose the 2.7 version and that oughta do it.
python and pip should now default to 2.7. python3 and pip3 would be used for 3.x after that.
I think I figured out the problem. easy_install command installs pip to python3.4 directory by default. I also tried using “zypper in python-pip” and had lots of errors.
Here are the errors:
Traceback (most recent call last):
File “/usr/bin/pip”, line 9, in <module>
load_entry_point(‘pip==1.5’, ‘console_scripts’, ‘pip2.7’)()
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 356, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2476, in load_entry_point
File “/usr/lib/python2.7/site-packages/pkg_resources.py”, line 2190, in load
File “/usr/lib/python2.7/site-packages/pip/init.py”, line 8, in <module>
from pip.exceptions import InstallationError, CommandError, PipError
File “/usr/lib/python2.7/site-packages/pip/pip/init.py”, line 13, in <module>
from pip.utils import get_installed_distributions, get_prog
File “/usr/lib/python2.7/site-packages/pip/utils/init.py”, line 18, in <module>
from pip.locations import (
File “/usr/lib/python2.7/site-packages/pip/locations.py”, line 9, in <module>
from pip.backwardcompat import get_python_lib, get_path_uid, user_site
ImportError: No module named backwardcompat
I think, I’ve done something really stupid.
To delete all python packages and reinstalling them I tried following:
- sudo zypper remove python. (although did not delete /usr/lib/python2.x and 3.x)
- sudo zypper install python (although did not install any of the packages that were deleted.)
What happened was tons of packages were deleted. here is the list from commandline:
apper command-not-found dbus-1-python gimp-plugins-python PackageKit PackageKit-backend-zypp PackageKit-branding-openSUSE python
python-configobj python-cupshelpers python-decorator python-gobject python-gobject2 python-gobject-cairo python-gtk python-Jinja2
python-kde4 python-kde4-akonadi python-kde4-khtml python-kde4-knewstuff python-kde4-phonon python-kde4-plasma python-kdebase4
python-MarkupSafe python-numpy python-pycurl python-qt4 python-simplejson python-sip python-six python-solv rpm-python scout
snapper-zypp-plugin synaptiks system-config-printer system-config-printer-applet system-config-printer-common
system-config-printer-dbus-service tuned udev-configure-printer
If this is a completely fresh untouched system with nothing, reinstall, install pip and update-alt like I showed easier, do NOT run easy_install and it should be fine.