没有名为 urdf2webots 的模块 - pip 在 sys.path 之外安装了包
No module named urdf2webots - pip installed package outside of sys.path
我通过 pip install urdf2webots
安装了一个包。使用命令 python -m urdf2webots.importer --input=Rover_2022.urdf --output=Rover_2022.proto
后,我得到 /bin/python: No module named urdf2webots
。我该如何解决这个问题?
没有sudo
which python
returns /bin/python
pip show urdf2webots
returns
Name: urdf2webots
Version: 1.0.16
Summary: A converter between URDF and PROTO files.
Home-page: https://github.com/cyberbotics/urdf2webots
Author: Cyberbotics
Author-email: support@cyberbotics.com
License: Apache License, Version 2.0
Location: /home/drakeprovost/.local/lib/python3.8/site-packages
Requires: rospkg, pycollada, numpy, Pillow
Required-by:
- 如果我得到
python
来打印 sys.path,我得到:
$ python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/opt/ros/foxy/lib/python3.8/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>>
与sudo
值得注意的是,我还使用 sudo
尝试了所有这些命令,以查看它是否更改了软件包的安装位置。确实如此,但问题仍然存在:
$ sudo python -m urdf2webots.importer --input=Rover_2022.urdf --output=Rover_2022.proto
产生 /usr/bin/python: No module named urdf2webots
sudo which python
产生 /usr/bin/python
sudo pip show urdf2webots
给出
Name: urdf2webots
Version: 1.0.16
Summary: A converter between URDF and PROTO files.
Home-page: https://github.com/cyberbotics/urdf2webots
Author: Cyberbotics
Author-email: support@cyberbotics.com
License: Apache License, Version 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: rospkg, Pillow, pycollada, numpy
Required-by:
- sys.path returns
$ sudo python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>>
我知道在这两种情况下 urdf2webots
的位置都不匹配 sys.path
的任何路径,但我不知道如何解决这个问题。有什么建议吗?
你可以试试:
python -m pip install urdf2webots
这将为您要使用的默认 python 安装库。
我通过 pip install urdf2webots
安装了一个包。使用命令 python -m urdf2webots.importer --input=Rover_2022.urdf --output=Rover_2022.proto
后,我得到 /bin/python: No module named urdf2webots
。我该如何解决这个问题?
没有sudo
which python
returns/bin/python
pip show urdf2webots
returns
Name: urdf2webots
Version: 1.0.16
Summary: A converter between URDF and PROTO files.
Home-page: https://github.com/cyberbotics/urdf2webots
Author: Cyberbotics
Author-email: support@cyberbotics.com
License: Apache License, Version 2.0
Location: /home/drakeprovost/.local/lib/python3.8/site-packages
Requires: rospkg, pycollada, numpy, Pillow
Required-by:
- 如果我得到
python
来打印 sys.path,我得到:
$ python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/opt/ros/foxy/lib/python3.8/site-packages', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>>
与sudo
值得注意的是,我还使用 sudo
尝试了所有这些命令,以查看它是否更改了软件包的安装位置。确实如此,但问题仍然存在:
$ sudo python -m urdf2webots.importer --input=Rover_2022.urdf --output=Rover_2022.proto
产生/usr/bin/python: No module named urdf2webots
sudo which python
产生/usr/bin/python
sudo pip show urdf2webots
给出
Name: urdf2webots
Version: 1.0.16
Summary: A converter between URDF and PROTO files.
Home-page: https://github.com/cyberbotics/urdf2webots
Author: Cyberbotics
Author-email: support@cyberbotics.com
License: Apache License, Version 2.0
Location: /usr/local/lib/python3.8/dist-packages
Requires: rospkg, Pillow, pycollada, numpy
Required-by:
- sys.path returns
$ sudo python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
>>>
我知道在这两种情况下 urdf2webots
的位置都不匹配 sys.path
的任何路径,但我不知道如何解决这个问题。有什么建议吗?
你可以试试:
python -m pip install urdf2webots
这将为您要使用的默认 python 安装库。