ubuntu系统下安装pip3及第三⽅库的安装
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
ubuntu怎么安装python更新好pip3之后
(2)配置pip3
⼀定要以管理员的⾝份进⾏修改
⾸先要到pip的配置⽂件,命令为
$:cd usr
$:cd bin
在以管理员的⾝份打开,否则没有权限修改
输⼊命令$:sudo vi /usr/bin/pip
将pip中的配置⽂件修改为以下
from pip import __main__
if __name__=='__main__':
**如果上⾯的错了,就把⽂件先改回去,然后再按照这个⽅法修改,直⾄你输⼊pip会出现各种命令使⽤⽅法,说明就成功了。
若成功如下
zztsj@zztsj-Nitro-AN515-51:/usr/bin$ pip3
Usage:
pip <command> [options]
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 <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host as trusted, even though it does not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
-
-client-cert <path> Path to SSL client certificate, a single file containing the private key and the certificate in PEM
format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
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为库的名字,可以根据你想安装的库进⾏修改
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论