码迷,mamicode.com
首页 > 数据库 > 详细

pip安装 MySQLDb 和 Django

时间:2016-06-28 20:32:57      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:

wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate
[root@localhost ~]#tar -xvf pip-1.5.4.tar.gz
[root@localhost pip-1.5.4]#python setup.py install 

1. pip使用详解

1.1 pip安装包

[root@localhost ~]# pip install Django  
[root@localhost ~]# pip install MySQL-python 

 

 1.2 pip查看已安装的包

[root@localhost ~]# pip list
MySQL-python (1.2.5)            //MySQLDb 
pip (1.5.4)
redis (2.10.5)
setuptools (23.1.0)
wsgiref (0.1.2)

1.3 pip检查哪些包需要更新

[root@localhost ~]# pip list --outdated
pip (Current: 1.5.4 Latest: 8.1.2)

1.4 pip升级包

[root@localhost ~]# pip install --upgrade redis
Requirement already up-to-date: redis in /usr/local/lib/python2.7/site-packages
Cleaning up...

1.5 pip卸载包

2. pip参数解释

[root@localhost ~]# 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.

 

 

[root@localhost lib.linux-x86_64-2.7]# python
Python 2.7.9 (default, Mar 20 2016, 17:45:53) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "MySQLdb/__init__.py", line 19, in <module>
    import _mysql
ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory

解决:

ln -s /usr/local/mysql56/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18

如果是64系统则:
ln -s /usr/local/mysql56/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

  vi /etc/ld.so.conf    //加入libmysqlclient.so.18 所在的目录:/usr/local/mysql56/lib/

  加入: /usr/lib/

  保存退出后执行/sbin/ldconfig生效



 

pip安装 MySQLDb 和 Django

标签:

原文地址:http://www.cnblogs.com/zengkefu/p/5624718.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!