在python中安装了模块,但仍然出现错误

在python中安装了模块,但仍然出现错误,python,module,peewee,Python,Module,Peewee,我尝试使用 sudopip安装peewee,但当我运行我的脚本时,仍然会出现错误 sudo pip install peewee [sudo] password for mounarajan: The directory '/home/mounarajan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check

我尝试使用

sudopip安装peewee,但当我运行我的脚本时,仍然会出现错误

sudo pip install peewee
[sudo] password for mounarajan: 
The directory '/home/mounarajan/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mounarajan/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting peewee
  Downloading peewee-2.8.0.tar.gz (470kB)
    100% |████████████████████████████████| 471kB 123kB/s 
Installing collected packages: peewee
  Running setup.py install for peewee ... done
Successfully installed peewee-2.8.0
尝试了这个python解释器

import peewee
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named peewee
导入peewee
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为peewee的模块
安装软件包时不要使用“sudo”

pip install peewee

如果您不小心使用了
sudo
安装了一些python软件包/公式,并像我一样获得了许可

$brew医生

可以帮助诊断并给出良好的建议。它帮助我解决了这个问题


如果您使用的是建议使用的虚拟环境,当然。应该没有必要使用
sudo
,这在大多数情况下是有风险的。

在命令行中启动python并尝试导入peewee,如果它起作用,ide的python bin是另一个