问题
I am unable to use virt-manager, and I think it's because of where my python is located. When I run the virt-manager
command I get: No module named libvirt
even though I have libvirt installed. When I run /usr/bin/python /usr/share/virt-manager/virt-manager.py
it works fine. The output from which python
is /usr/local/bin/python
. I've tried creating a ~/.bash_profile
that contains this: export PYTHONPATH=$PYTHONPATH:/usr/bin/python
but am still having the same problem.
I'm sure there is a simple solution to this?
回答1:
You can make a symbolyc link
sudo mv /usr/local/bin/python python-old #example name
sudo ln -s /usr/bin/python /usr/local/bin/python
回答2:
To be clear, the PYTHONPATH environmental variable sets where your python session looks for modules. It doesn't set the location of your python interpreter, which I think is what you want to do.
What you need to do is add and alias for the python interpreter that you do want to use to your bash_profile. Something like this:
alias python='/usr/bin/python'
来源:https://stackoverflow.com/questions/29970027/how-do-i-update-pythonpath-from-usr-local-bin-python-to-usr-bin-python