简体   繁体   中英

Trouble installing packages in the wrong Python version

I'm having problems while installing a new package in Python. I was looking for the termcolor package. I installed it using the apt:

sudo apt-get install python-termcolor

But when I try to use it in Python 3.6 it keep telling me that's not installed. I checked whether it was and I got:

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

So I understand that the package was correctly installed, but in the v2.7. How do I get it installed in the v3.6?

EDIT: I've read that if a use the pip installer, I could assign in which version of Python I'd like it installed, like using pip3 to install the package in 3.XX. But I tried it, it says that it was correctly installed and when I open Python 3.6 and try to use it, still got the ModuleNotFoundError.

EDIT2: After checking one more time, I discovered that with pip3 I installed the termcolor package in Python 3.5.3, but how can I get it installed in Python 3.6.1?

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

sudo apt-get install python3-termcolor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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