千家信息网

怎么在linux系统中安装pip源

发表于:2025-02-06 作者:千家信息网编辑
千家信息网最后更新 2025年02月06日,本篇文章给大家分享的是有关怎么在linux系统中安装pip源,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。什么是Linux系统Linux
千家信息网最后更新 2025年02月06日怎么在linux系统中安装pip源

本篇文章给大家分享的是有关怎么在linux系统中安装pip源,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

什么是Linux系统

Linux是一种免费使用和自由传播的类UNIX操作系统,是一个基于POSIX的多用户、多任务、支持多线程和多CPU的操作系统,使用Linux能运行主要的Unix工具软件、应用程序和网络协议。

一、pip下载安装

1.1 pip下载

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

1.2 pip安装

1

2

3

# tar -xzvf pip-1.5.4.tar.gz

# cd pip-1.5.4

# python setup.py install

二、pip使用详解

2.1 pip安装软件

1

2

3

# pip install SomePackage

[...]

Successfully installed SomePackage

2.2 pip查看已安装的软件

1

2

3

4

5

6

7

# pip show --files SomePackage

Name: SomePackage

Version: 1.0

Location: /my/env/lib/pythonx.x/site-packages

Files:

../somepackage/__init__.py

[...]

2.3 pip检查哪些软件需要更新

1

2

# pip list --outdated

SomePackage (Current: 1.0 Latest: 2.0)

2.4 pip升级软件

1

2

3

4

5

6

7

# pip install --upgrade SomePackage

[...]

Found existing installation: SomePackage 1.0

Uninstalling SomePackage:

Successfully uninstalled SomePackage

Running setup.py install for SomePackage

Successfully installed SomePackage

2.5 pip卸载软件

2

3

4

5

$ pip uninstall SomePackage

Uninstalling SomePackage:

/my/env/lib/pythonx.x/site-packages/somepackage

Proceed (y/n)? y

Successfully uninstalled SomePackage

三、pip使用实例

3.1 安装Redis

# pip install redis

3.2 卸载redis

2

3

4

5

6

# pip uninstall redis

Uninstalling redis:

/usr/lib/python2.6/site-packages/redis-2.9.1-py2.6.egg-info

.....省略一些内容....

Proceed (y/n)? y

Successfully uninstalled redis

3.3 查看待更新软件

2

3

4

pip list --outdate

pygpgme (Current: 0.1 Latest: 0.3)

pycurl (Current: 7.19.0 Latest: 7.19.3.1)

iniparse (Current: 0.3.1 Latest: 0.4)

四、常见错误

4.1 ImportError No module named setuptools

请参考《ImportError No module named setuptools解决》

五、pip参数解释

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

# pip --help

Usage:

pip [options]

Commands:

install 安装软件.

uninstall 卸载软件.

freeze 按着一定格式输出已安装软件列表

list 列出已安装软件.

show 显示软件详细信息.

search 搜索软件,类似yum里的search.

wheel Build wheels from your requirements.

zip 不推荐. Zip individual packages.

unzip 不推荐. Unzip individual packages.

bundle 不推荐. Create pybundles.

help 当前帮助.

General Options:

-h, --help 显示帮助.

-v, --verbose 更多的输出,最多可以使用3次

-V, --version 现实版本信息然后退出.

-q, --quiet 最少的输出.

--log-file 覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log

--log 不覆盖记录verbose输出的日志.

--proxy Specify a proxy in the form [user:passwd@]proxy.server:port.

--timeout 连接超时时间 (默认15秒).

--exists-action Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.

--cert 证书.

以上就是怎么在linux系统中安装pip源,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注行业资讯频道。

0