Ubuntu18.04中使用pip包管理的注意事项

Ubuntu18.04自带了python2和python3,默认执行pip安装包实际上安装的是python2的包,如果要管理python3的包需要使用命令pip3.

安装pip和pip3:
sudo apt-get install python2-pip
sudo apt-get install python3-pip

#查看pip的版本
pip -V
pip3 -V

#搜索包
pip3 search bs4

#安装puthon3的包
pip3 install bs4

#pip3默认搜索的是国外的镜像,很慢,修改为国内的
mkdir ~/.pip
cd ~/.pip
touch pip.conf
gedit pip.conf

然后将pip.conf文件修改为以下内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

本文作者: GavinDong

版权属于: GavinDong博客

文章链接: https://gavindong.com/2629.html

如果使用过程中遇到问题,可 **点击此处** 交流沟通。

版权所有,转载时必须以链接形式注明作者和原始出处及本声明。

(0)

相关文章

回复 ag

登录后才能评论

评论列表(1条)

  • ag的头像
    ag 2018.07.18 13:27

    whereis pip
    whereis pip3