问题描述
我有一个 ROS动力学的 Ubuntu 16.04 OS .
I have an Ubuntu 16.04 OS with ROS kinetic.
当我打开一个终端并输入python
时,它将加载python 2.7,而当我尝试import imutils
时,它说该目录不存在.
When I open a terminal and type python
it loads python 2.7, and as I try to import imutils
it says it's not there.
然后,我尝试使用pip install imutils
安装它,但是它说:requirment already satisfied in bla/bla/python3.5/bla.
Then, I tried to install it with pip install imutils
, but it says: requirment already satisfied in bla/bla/python3.5/bla.
如果我打开终端并输入python3
,它将加载 Python 3.5 ,并且当我尝试导入该lib时,它会抱怨找不到c5,并给出一个指向Python ROS软件包所在位置的地址( Python 2.7 ).
If I open the terminal and type python3
, it loads Python 3.5, and when I try to import that lib, it complaints that it can't find cv2
, and gives an address pointing to where the Python ROS package is located (Python 2.7).
到目前为止,这对我来说很有意义(我知道.bashrc
正在加载ROS软件包),但是,然后,如何在Python版本的ROS中安装imutils
?我想将兼容的imutils
与我的 ROS Kinetic 一起使用.
Up to this point, it makes sense to me (I am aware of the .bashrc
loading the ROS packages), but then, how can I install imutils
in the Python version of ROS? I want to use the compatible imutils
with my ROS Kinetic.
推荐答案
您的问题是您的pip
设置为 Python 3.5 .
Your problem is that your pip
is set to Python 3.5.
因此,您可以改用pip2
绕过它:
So, you can bypass it using pip2
instead:
pip2 install imutils
或
sudo pip2 install imutils
[注意]:
检查您的pip
到Python版本分配的链接:
Check your pip
s link to Python versions assignment:
pip --version
pip2 --version
pip3 --version
sudo pip --version
sudo pip2 --version
sudo pip3 --version
然后选择分配给这些pip
的所需Python版本,或者您可以更改pip
的链接地址().
Then choose the desired Python version which assigned to these pip
or you can change the pip
s link address (a relevant post).
这篇关于在ROS中安装Imutils的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!