ubuntu系统下会⾃带python2.x和python3.x坏境,不需要我们去安装。并且ubuntu系统下还会⾃动帮助我们安装python2.x坏境下的pip安装⼯具,
但是没有python3.x坏境下的pip3安装⼯具需要我们⼿动安装。(1)安装pip3
⾸先输⼊命令$:python3-v
查看python3的具体版本,我这⾥是python3.6.
然后开始安装pip3,输⼊命令$:sudo apt-get install python3-pip⾃⼰下载并进⾏安装,完成后,输⼊命令$:pip3-v查看pip3的版本*这⾥要注意 ⼀定要更新pip3输⼊命令$:pip install --upgrade pip更新好pip3之后(2)配置pip3
⼀定要以管理员的⾝份进⾏修改⾸先要找到pip的配置⽂件,命令为$:cd usr$:cd bin
在以管理员的⾝份打开,否则没有权限修改输⼊命令$:sudo vi /usr/bin/pip将pip中的配置⽂件修改为以下from pip import __main__if __name__=='__main__': sys.exit(__main__._main())
**如果上⾯的错了,就把⽂件先改回去,然后再按照这个⽅法修改,直⾄你输⼊pip会出现各种命令使⽤⽅法,说明就成功了。若成功如下
zztsj@zztsj-Nitro-AN515-51:/usr/bin$ pip3Usage:
pip Commands: install Install packages. download Download packages. uninstall Uninstall packages. freeze Output installed packages in requirements format. list List installed packages. show Show information about installed packages. check Verify installed packages have compatible dependencies. search Search PyPI for packages. wheel Build wheels from your requirements. hash Compute hashes of package archives. completion A helper command used for command completion. help Show help for commands. General Options: -h, --help Show help. --isolated Run pip in an isolated mode, ignoring environment variables and user configuration. -v, --verbose Give more output. Option is additive, and can be used up to 3 times. -V, --version Show version and exit. -q, --quiet Give less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels). --log --proxy --retries --exists-action --client-cert --cache-dir Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.(3)安装第三⽅库 输⼊命令为$:pip3 install lxml 其中lxml为库的名字,可以根据你想安装的库进⾏修改 因篇幅问题不能全部显示,请点此查看更多更全内容