Help us understand the problem. What is going on with this article?

HIDデバイスをconda環境で実行

http://akizukidenshi.com/catalog/g/gM-05131/
http://km2net.com/usb-io2.0/index.shtml
こちらのデバイスを使うと、様々なセンサやアクチュエータをパソコンから直接制御できて便利。
pythonで制御する場合、import hidpip install hidapiでインストール。https://github.com/trezor/cython-hidapi)
でインポートし、プログラムを書く。

問題点

そのファイルを実行する際に、devへの権限がrootでないと得られないので
sudo python xxx.py
で実行しなければならない。
しかし、bearという仮想環境上で動かしたい。
sudo python(bear) pythonで参照する先のpythonが違い、困った。

(bear) username@username:~$ which python
/home/username/PythonVirtualEnvironments/DefaultEnv3.7/bin/python

(bear) username@username:~$ sudo which python
/usr/bin/python

解決法

bear仮想環境上でwhich pythonと打ち
出てきた先のパスをコピペ。

上記のように出たので、

(bear) username@username:~$ sudo /home/username/PythonVirtualEnvironments/DefaultEnv3.7/bin/python xxx.py

で問題なく実行できた。
今は、devへのアクセス権限のあるグループを変更することを検討中。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした