如何将 PYTHONPATH 从/usr/local/bin/python 更新到/usr/bin/python [英] how do I update PYTHONPATH from /usr/local/bin/python to /usr/bin/python

查看:63
本文介绍了如何将 PYTHONPATH 从/usr/local/bin/python 更新到/usr/bin/python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用 virt-manager,我认为这是因为我的 python 所在的位置.当我运行 virt-manager 命令时,我得到:No module named libvirt 即使我安装了 libvirt.当我运行 /usr/bin/python/usr/share/virt-manager/virt-manager.py 它工作正常.which python 的输出是 /usr/local/bin/python.我已经尝试创建一个 ~/.bash_profile 包含这个: export PYTHONPATH=$PYTHONPATH:/usr/bin/python 但我仍然有同样的问题.我确定有一个简单的解决方案吗?

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?

推荐答案

可以制作符号链接,例如:

You can make a symbolic link, example:

sudo mv /usr/local/bin/python python-old # example name
sudo ln -s /usr/bin/python /usr/local/bin/python

这篇关于如何将 PYTHONPATH 从/usr/local/bin/python 更新到/usr/bin/python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆