在python中安装模块,仍然有错误

时间:2016-04-04 05:47:07

标签: python module peewee

我尝试使用

为python安装peewee模块

sudo pip install 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 Interpreter

import peewee
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named peewee

2 个答案:

答案 0 :(得分:3)

安装包时请勿使用“sudo”。

pip install peewee

答案 1 :(得分:-2)

有几个相关/重复的答案。但是我个人不小心使用sudo来安装一些python包/公式,并且使用了这个权限。

  

$ brew doctor

是你的朋友。你会找到一些好的建议来解决你的问题。

另一个建议是使用virtualenv进行python。谷歌提供您最喜欢的教程和使用它的文章。