Python中安装库时报错:WARNING: Running pip as the ‘root‘ user can re

发布时间:2024-01-09作者:小灵龙点击:76

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv




1、通过find命令查找pip安装位置:
 

find / -name pip-*
 

2、使用cd命令跳转到pip安装位置
 

cd /usr/bin
 

3、建立虚拟环境
 

python3 -m venv tutorial-env
 

4、激活和使用虚拟环境
 
Linux下:

source tutorial-env/bin/activate
 

此处命令执行是没有回显的
标签: