linux服务器怎么安装pip

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux服务器怎么安装pip相关的知识,希望对你有一定的参考价值。

1、先说一下什么是pip
pip 是“A tool for installing and managing Python packages.”,也就是说pip是python的软件安装工具
2、下面介绍怎么在linux下安装pip
下载pip到/usr/local/src
# cd /usr/local/src
# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
如果提示:-bash: wget: command not found
那么安装wget,执行如下:
# yum -y install wget

解夺安装pip
# tar -xzvf pip-1.5.4.tar.gz
# cd pip-1.5.4
# python setup.py install

如果安装报下面的错:
Traceback (most recent call last):
File "setup.py", line 6, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools

那么就要先安装setuptools包
(1)下载setuptools包
# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
(2)解压setuptools包
# tar zxvf setuptools-2.0.tar.gz
# cd setuptools-2.0
(3)编译setuptools
# python setup.py build
(4)开始执行setuptools安装
# python setup.py install

安装完成setuptools包后,在重新执行:
# cd /usr/local/src/pip-1.5.4
# python setup.py install
至此pip安装完成

3、linux下pip使用参数
# pip --help

Usage:
pip <command> [options]

Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
zip DEPRECATED. Zip individual packages.
unzip DEPRECATED. Unzip individual packages.
bundle DEPRECATED. Create pybundles.
help Show help for commands.

General Options:
-h, --help Show help.
-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.
--log-file <path> Path to a verbose non-appending log, that only logs failures. This log is active by default at /root/.pip/pip.log.
--log <path> Path to a verbose appending log. This log is inactive by default.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--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.
--cert <path> Path to alternate CA bundle.
参考技术A

首先Linux服务器上更新python,pip的下载和安装,setuptools的下载和安装,pytest的安装。

先说一下什么是pip:pip 是“A tool for installing and managing Python packages.”,也就是说pip是python的软件安装工具

下面介绍怎么在linux下安装pip

下载pip到/usr/local/src

# cd /usr/local/src

# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate

如果提示:-bash: wget: command not found

那么安装wget,执行如下:

# yum -y install wget 

解夺安装pip

# tar -xzvf pip-1.5.4.tar.gz

# cd pip-1.5.4

# python setup.py install

参考技术B 1、先说一下什么是pip
pip 是“A tool for installing and managing Python packages.”,也就是说pip是python的软件安装工具
2、下面介绍怎么在linux下安装pip
下载pip到/usr/local/src
# cd /usr/local/src
# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
如果提示:-bash: wget: command not found
那么安装wget,执行如下:
# yum -y install wget

解夺安装pip
# tar -xzvf pip-1.5.4.tar.gz
# cd pip-1.5.4
# python setup.py install

如果安装报下面的错:
Traceback (most recent call last):
File "setup.py", line 6, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptools

那么就要先安装setuptools包
(1)下载setuptools包
# wget http://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz
(2)解压setuptools包
# tar zxvf setuptools-2.0.tar.gz
# cd setuptools-2.0
(3)编译setuptools
# python setup.py build
(4)开始执行setuptools安装
# python setup.py install

安装完成setuptools包后,在重新执行:
# cd /usr/local/src/pip-1.5.4
# python setup.py install
至此pip安装完成

3、linux下pip使用参数
# pip --help

Usage:
pip <command> [options]

Commands:
install Install packages.
uninstall Uninstall packages.
freeze Output installed packages in requirements format.
list List installed packages.
show Show information about installed packages.
search Search PyPI for packages.
wheel Build wheels from your requirements.
zip DEPRECATED. Zip individual packages.
unzip DEPRECATED. Unzip individual packages.
bundle DEPRECATED. Create pybundles.
help Show help for commands.

General Options:
-h, --help Show help.
-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.
--log-file <path> Path to a verbose non-appending log, that only logs failures. This log is active by default at /root/.pip/pip.log.
--log <path> Path to a verbose appending log. This log is inactive by default.
--proxy <proxy> Specify a proxy in the form [user:passwd@]proxy.server:port.
--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.
--cert <path> Path to alternate CA bundle.

在linux中安装pip

使用3A服务器搭建的linux系统,安装pip,有需要的后台私信我

由于系统自带的pyhon中没有pip,而我们这时候恰好需要用到pip,怎么办呢?今天我就来教大家如何在linux中安装pip;

pip下载

下载任意一个版本就可以;需要哪个版本可以选择第二种,需要哪个版本改一下版本就好了;

#pip22.2.2版本

wget https://files.pythonhosted.org/packages/4b/30/e15b806597e67057e07a5acdc135216ccbf76a5f1681a324533b61066b0b/pip-22.2.2.tar.gz

#pip1.5.4版本

wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz

#pip9.0.1版本

wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz

pip安装

就拿9.0.1版本来做吧

#解压压缩包

tar xf pip-9.0.1.tar.gz

#进入pip-9.0.1目录

cd pip-9.0.1

#进行安装

python setup.py install

发现安装报错

 

原因是因为:安装pip时提示setup.py中使用setuptools中的模块,但是我们开始并没有安装setuptools软件包,所以我们需要先下载并安装 setuptools!

下载/安装setuptools

1、下载setuptools

#下载setuptools

wget https://pypi.python.org/packages/28/4f/889339f38da415e49cff15b21ab27becbf4c017c79fbfdeca663f5b33b36/setuptools-36.4.0.zip

2、解压setuptools包

unzip setuptools-36.4.0.zip

cd setuptools-36.4.0

3、编译setuptools

python setup.py build

4、开始执行setuptools安装

python setup.py install

Finished代表成功!

 

再次安装pip

现在,setuptools已经安装好,我们再次进入pip-9.0.1目录,使用 “python setup.py install” 命令安装pip:

cd pip-9.0.1

python setup.py install

Finished代表成功!

验证pip安装是否成功

pip --version

能查到说明安装成功,接下来我们就可以安装自己想要的包了;

 

测试使用pip命令安装需要的包

pip install nose

pip install virtualenv

pip install distribute

pip install runlike

 

以上是关于linux服务器怎么安装pip的主要内容,如果未能解决你的问题,请参考以下文章

linux怎么安装dhcp服务器

linux12.04怎么安装高版本的svn

linux 服务器怎么开启snmp

linux 安装后没有图形界面怎么回事

怎么解决安装linux软件的依赖问题

怎么查看linux是不是安装web