在pycharm中为M创建Django项目时,出现以下错误

2024-04-26 02:51:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我在终端中使用以下命令安装了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

有人能帮我吗?谢谢!你知道吗


Tags: pipandthedjangoinlibpackagesusr
1条回答
网友
1楼 · 发布于 2024-04-26 02:51:26

错误消息表明文件夹不属于当前用户。因此,您需要通过以下命令更改所有者:

sudo chown kinredon -R /Users/kinredon/Library/Caches/pip

进一步了解chownhere。你知道吗

相关问题 更多 >