简体   繁体   中英

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. I installed telepot with the command to a 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

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:

  1. activate your virtualenv
  2. pip install telepot
  3. get the path to virtualenv's Python with which python
  4. deactivate virtualenv
  5. execute sudo <path_to_python_from_step3>
  6. import telepot should work now

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