2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pip installしたはずなのにImport errorを解決する方法

Last updated at Posted at 2020-01-07
$ pip install tweepy --user
Requirement already satisfied: tweepy in /home/ubuntu/.local/lib/python3.7/site-packages (3.8.0)
Requirement already satisfied: six>=1.10.0 in /usr/lib/python3/dist-packages (from tweepy) (1.11.0)
Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/ubuntu/.local/lib/python3.7/site-packages (from tweepy) (1.3.0)
Requirement already satisfied: PySocks>=1.5.7 in /home/ubuntu/.local/lib/python3.7/site-packages (from tweepy) (1.7.1)
Requirement already satisfied: requests>=2.11.1 in /usr/lib/python3/dist-packages (from tweepy) (2.18.4)
Requirement already satisfied: oauthlib>=3.0.0 in /home/ubuntu/.local/lib/python3.7/site-packages (from requests-oauthlib>=0.7.0->tweepy) (3.1.0)

してるのに


$ python3 followback_unfollow.py
Traceback (most recent call last):
  File "followback_unfollow.py", line 3, in <module>
    import tweepy
ModuleNotFoundError: No module named 'tweepy'
ubuntu@ip-192-168-1-89:~/my-app$ 

解決するには

$ export PYTHONPATH=$PYTHONPATH:/home/ubuntu/.local/lib/python3.7/site-packages

して

$ source ~/.bashrc

する。

$ python3 followback_unfollow.py
Works!!!
参考

pip installしたはずなのにImport errorと言われた場合
pipでインストールしたパッケージの場所を調べる

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?