[英]Error while importing telepot
I'm trying to build my own bot but I've some troubles when I try to import the telepot
package. 我正在尝试构建自己的机器人,但是在尝试导入
telepot
软件包时遇到了一些麻烦。 I installed telepot with the command to a virtualenv
: 我使用命令将telepot安装到
virtualenv
:
pip install telepot
and I've no problems when I do 而且我做的时候没有问题
python
import telepot
But to use the GPIO
it's necessary the be the super user, so 但是要使用
GPIO
,必须成为超级用户,因此
sudo python
import telepot
but the answer is 但是答案是
ImportError: No module named telepot
What is wrong? 怎么了?
Since you are using virtualenv
and want to execute Python with sudo
, try this: 由于您正在使用
virtualenv
并想使用sudo
执行Python,请尝试以下操作:
pip install telepot
which python
which python
virtualenv的Python路径 sudo <path_to_python_from_step3>
sudo <path_to_python_from_step3>
import telepot
should work now import telepot
应立即工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.