因为pip是一个命令行指令 不能这样在python环境里面使用
如果真想使用,可以参考下面,以安装pandas为例:
from pip._internal import main
# pip install pandas
main(['install','pandas'])
# pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ pandas
main(['install','-i','https://pypi.tuna.tsinghua.edu.cn/simple/','pandas'])
不能这样用的,pip不是python的函数和想import from一样的指令
您好,我是有问必答小助手,您的问题已经有小伙伴帮您解答,感谢您对有问必答的支持与关注!