python - 找不到适用于 python2 命令的平台独立库
问题描述
我正在尝试在 Linux Mint 计算机上安装 pip2,pip3 已经安装在 /.local/lib/python3.6/site-packages 中。我还安装了 Python 2.7 和 Python 3.7:
$ python -V
Python 2.7.15+
$ python3 -V
Python 3.6.9
但是当我尝试安装 pip2 时,它给出了以下错误:
$ python get-pip.py
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site
运行命令 python3 正常打开 python shell,但运行命令 python 给出相同的错误。$PYTHONHOME 或 $PYTHONPATH 均未设置。有人可以向我解释如何解决这个问题吗?
编辑:我没有使用虚拟环境。运行 apt-get check python2 不会显示任何损坏的依赖项。当我将 PYTHONHOME 设置为 /usr 时,python3 命令仍然打开 shell,但是 python 和 python2 命令给出 ImportError: No module named site
解决方案
推荐阅读
- powershell - 如何 ALTER....CHECK CHECK CONSTRAINT 使用 PowerShell 和 SMO
- python - 在Python中对矩阵的选定元素求和
- bash - 查找并终止在终端打开 MACOSX 上加载的 bash 命令变量
- performance - 为什么这个 fortran 循环在以稍微不同的方式实现时更有效?
- delphi - 如何锁定和隐藏 FastReport 对象检查器?
- java - 在 Appium-Java 中使用移动命令进行后门时出现异常
- python - 字符串中最后一个单词的正则表达式?
- javascript - 如何在 D3.js 中读取多个文件以绘制在一个折线图上
- java - json 数组中的逗号分隔值被视为分隔符
- remote-desktop - RemoteApp 使用扫描仪驱动程序