繁体   English   中英

无法在错误的Python版本中安装软件包

[英]Trouble installing packages in the wrong Python version

在Python中安装新软件包时遇到问题。 我一直在寻找termcolor包装。 我使用apt安装了它:

sudo apt-get install python-termcolor

但是,当我尝试在Python 3.6中使用它时,它总是告诉我尚未安装。 我检查了是否得到:

cris@Manaos:~$ dpkg -L python-termcolor
/.
/usr
/usr/share
/usr/share/pyshared
/usr/share/pyshared/termcolor-1.1.0.egg-info
/usr/share/pyshared/termcolor.py
/usr/share/doc
/usr/share/doc/python-termcolor
/usr/share/doc/python-termcolor/README.rst
/usr/share/doc/python-termcolor/copyright
/usr/share/doc/python-termcolor/changelog.Debian.gz
/usr/share/doc/python-termcolor/CHANGES.rst
/usr/lib
/usr/lib/python2.7
/usr/lib/python2.7/dist-packages
/usr/lib/python2.7/dist-packages/termcolor-1.1.0.egg-info
/usr/lib/python2.7/dist-packages/termcolor.py

因此,我了解该软件包已正确安装,但安装在v2.7中。 如何在v3.6中安装它?

编辑:我读过,如果使用pip安装程序,我可以指定要安装在哪个版本的Python中,就像使用pip3在3.XX中安装软件包一样。 但是我尝试了一下,它说它已经正确安装,当我打开Python 3.6并尝试使用它时,仍然收到ModuleNotFoundError。

EDIT2:经过一段时间的检查,我发现使用pip3在Python 3.5.3中安装了termcolor包,但是如何在Python 3.6.1中安装它呢?

您需要指定您想要的python 3版本。

sudo apt-get install python3-termcolor

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM