更新时间:2023-10-23 13:32:22
您需要激活首先是您的虚拟环境.
You need to activate your virtual environment first.
$ source PATH_TO_ENV/bin/env
$ pip install django
在新创建的virtualenv中,还将有一个激活Shell脚本.对于Windows系统,为命令提示符和Powershell提供了激活脚本.
In a newly created virtualenv there will also be a activate shell script. For Windows systems, activation scripts are provided for the Command Prompt and Powershell.
在Posix系统上,它位于/ENV/bin/
On Posix systems, this resides in /ENV/bin/
除非您执行此操作,否则您将使用系统python和系统库.这就是为什么您看到此错误.
Unless you do this you are using system python and system libs. That's why you see the error.
如果需要将lib安装到系统范围中,则需要root访问权限:
If you need to install a lib into the system scope you need root access:
$ sudo pip install django