使用pip来管理python包
2015/10/10 time 20:38
一、安装pip 【Linux】 yum install python-pip 【Win】 安装python时,默认已经安装pip 二、使用pip安装包 【Linux】 [root@tvm-test ~]# pip install Django==1.6.0 Collecting Django==1.6.0 /usr/lib/python2.6/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning Downloading Django-1.6-py2.py3-none-any.whl (6.7MB) 100% |████████████████████████████████| 6.7MB 74kB/s Installing collected packages: Django Successfully installed Django-1.6 [root@tvm-test ~]# python -c "import django;print(django.get_version())" 1.6 【Win】 D:\apps\Python34\Scripts>pip install Django You are using pip version 6.0.8, however version 7.1.0 is available. You should consider upgrading via the ‘pip install --upgrade pip‘ command. Collecting Django Downloading Django-1.8.3-py2.py3-none-any.whl (6.2MB) 100% |################################| 6.2MB 75kB/s Installing collected packages: Django D:\apps\Python34>python -c "import django;print(django.get_version())" 1.8.3 Successfully installed Django-1.8.3 三、其他用法 指定版本号安装: pip install Django==1.6.0 卸载: pip install Django 从文本文件中安装指定的包: pip install -r requirements.txt pip freeze >requirements.txt 四、版本问题 在windows下安装 ovirt-engine-sdk-python 时遇到异常: # pip install ovirt-engine-sdk-python Please specify --curl-dir=/path/to/built/libcurl pycurl异常,,官网是win32的版本,安装后,后续使用可能会报错: pycurl DLL load failed: %1 不是有效的 Win32 应用程序。 可以在这里找到amd64的版本,然后用pip手动安装: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl ZYXW、参考 1、Django 环境搭建 http://www.ziqiangxuetang.com/django/django-install.html
原文地址:http://nosmoking.blog.51cto.com/3263888/1704670