pip相关操作

一、pip

1、pip下载安装

1.1 pip下载

1

# 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

2. 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卸载包

1 2 3 4 5

$ pip uninstall SomePackage   Uninstalling SomePackage:     /my/env/lib/pythonx.x/site-packages/somepackage   Proceed (y/n)? y   Successfully uninstalled SomePackage

3. pip使用实例

3.1 安装redis

1

# pip install redis

3.2 卸载redis

1 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 查看待更新包

1 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. 常见错误

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

5. pip参数解释

1 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 <command> [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 <path>           覆盖的方式记录verbose错误日志,默认文件:/root/.pip/pip.log   --log <path>                不覆盖记录verbose输出的日志.   --proxy <proxy>             Specify a proxy in the form [user:[email protected]]proxy.server:port.   --timeout <sec>             连接超时时间 (默认15秒).   --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.   --cert <path>               证书.

二、常用升级命令

1.把pip、django升级到最新

python -m pip install --upgrade
pip install --upgrade django

2.查看pip的版本

pip --version
pip -V

3.查看django版本

python
import django
django.VERSION

三、常用操作初始化数据库,设置超管命令

1.初始化

python manage.py migrate
python manage.py makemigrations

2.设置超级管理员

python manage.py createsuperuser

3.初始化不成功时,启用这个

python manage.py migrate --fake-initial

原文地址:https://www.cnblogs.com/qiaodongdong/p/10269902.html

时间: 2024-08-03 22:48:25

pip相关操作的相关文章

二叉树的相关操作

#include<stdio.h> #include<malloc.h> #define MAXSIZE 20 typedef char TEelemtype; typedef struct BiTNode{ TEelemtype data; struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; //队列的方式 typedef struct queueelem { BiTNode* b[MAXSIZE]; int front,rear;

(二十四)linux新定时器:timefd及相关操作函数

timerfd是Linux为用户程序提供的一个定时器接口.这个接口基于文件描述符,通过文件描述符的可读事件进行超时通知,所以能够被用于select/poll的应用场景. 一,相关操作函数 #include <sys/timerfd.h> int timerfd_create(int clockid, int flags); int timerfd_settime(int fd, int flags, const struct itimerspec *new_value, struct itim

二叉树各种相关操作(建立二叉树、前序、中序、后序、求二叉树的深度、查找二叉树节点,层次遍历二叉树等)(C语言版)

将二叉树相关的操作集中在一个实例里,有助于理解有关二叉树的相关操作: 1.定义树的结构体: 1 typedef struct TreeNode{ 2 int data; 3 struct TreeNode *left; 4 struct TreeNode *right; 5 }TreeNode; 2.创建根节点: 1 TreeNode *creatRoot(){ 2 TreeNode * root =(TreeNode *)malloc(sizeof(TreeNode)); 3 if(NULL=

linux下进程相关操作

一.定义和理解 狭义定义:进程是正在运行的程序的实例. 广义定义:进程是一个具有一定独立功能的程序关于某个数据集合的一次运行活动. 进程的概念主要有两点: 第一,进程是一个实体.每一个进程都有它自己的地址空间,一般情况下,包括文本区域.数据区域和堆栈区域.文本区域存储处理器执行的代码:数据区域存储变量和进程执行期间使用的动态分配的内存:堆栈区域存储着活动过程调用的指令和本地变量. 第二,进程是一个“执行中的程序”.程序是一个没有生命的实体,只有处理器赋予程序生命时,它才能成为一个活动的实体,我们

android DataBase的相关操作(建立表结构和创建表)

先建立一个table的基类: public abstract class DbBaseTable { private static final String TAG = "DbBaseTable"; /** * @return the DB table name */ abstract String getName(); /** * Creates the DB table according to the DB scheme * * @param db */ abstract voi

WebView中的视频全屏的相关操作

最近工作中,基本一直在用WebView,今天就把它整理下: WebView 顾名思义,就是放一个网页,一个看起来十分简单,但是用起来不是那么简单的控件. 首先你肯定要定义,初始化一个webview,其实网上的例子很多,我这里就简单的把一些WebView 中可能会用到的的很重要的属性以及支持全屏播放视频该怎么实现的代码粘出来,直接放到项目中去就行了 <span style="white-space:pre"></span><pre name="co

jQuery学习笔记--JqGrid相关操作 方法列表(上)

1.获得当前列表行数:$("#gridid").getGridParam("reccount"); 2.获取选中行数据(json):$("#gridid").jqGrid('getRowData', id); 3.刷新列表:$(refreshSelector).jqGrid('setGridParam', { url: ''), postData: ''}).trigger('reloadGrid'); 4.选中行:$("#jqGrid

JQuery select控件的相关操作

本文转载于 http://www.cnblogs.com/zfc2201/archive/2012/09/06/2674312.html JQuery获取和设置Select选项方法汇总如下: 获取select 先看看下面代码: $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发 var checkText=$("#select_id").find("option:s

python文件相关操作

Python文件相关操作 打开文件 打开文件,采用open方法,会将文件的句柄返回,如下: f = open('test_file.txt','r',encoding='utf-8') 在上面的代码中,open()方法进行打开文件等相关操作,open()方法其中第一个参数是要打开的文件的文件路径,第二个参数是对要打开文件要执行的权限,第三个参数是文件采用字符编码. 而open()方法返回的内容叫做文件句柄.我们可以打印返回的文件句柄来看下: f = open('test_file.txt','r