我在终端使用以下命令安装了django:
sudo pip3 install django
我收到了这个回复:
kinredondeMacBook-Air:~ kinredon$ sudo pip3 install jiango
The directory '/Users/kinredon/Library/Caches/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 '/Users/kinredon/Library/Caches/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.
Requirement already satisfied: jiango in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: django<1.5,>=1.4 in /usr/local/lib/python3.6/site-packages (from jiango)
然后我在Pycharm中创建了一个django项目,我得到以下错误:
Error:Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/bin/django-admin.py", line 2, in <module>
from django.core import management
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 54
except ImportError,e:
^
SyntaxError: invalid syntax
任何人都可以帮助我吗?谢谢!
答案 0 :(得分:0)
错误消息表明该文件夹不归当前用户所有。因此,您需要通过以下命令更改所有者:
sudo chown kinredon -R /Users/kinredon/Library/Caches/pip
详细了解chown here。