pip
1 pip下载
wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb --no-check-certificate
2 查看python版本
[root@pre-storedb03 soft]# python -V
Python 2.6.6
因为python的版本都2.7.13了 所以我们先把python升级了,免得pip装上用不了
3 下载python新版本
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
4 安装python
tar -zxvf Python-2.7.13.tgz
./configure --prefix=/usr/local/python
make
make install
ln -s /usr/local/python27/bin/python /usr/bin/python
6 安装pip
[root@pre-storedb03 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
7 发现还需要先装setuptools
wget https://pypi.python.org/packages/a9/23/720c7558ba6ad3e0f5ad01e0d6ea2288b486da32f053c73e259f7c392042/setuptools-36.0.1.zip#md5=430eb106788183eefe9f444a300007f0
python setup.py install
[root@pre-storedb03 pip-1.5.4]# pip list
-bash: pip: command not found
发现pip用不了 重新搞一下环境变量
PATH=$PATH:$HOME/bin:/usr/local/python27/bin 添加到 ~/.bash_profile
[root@pre-storedb03 bin]# pip list
pip (1.5.4)
setuptools (36.0.1)
wsgiref (0.1.2)
发现pip ok了
8 pip使用
pip list --outdated #列出所有过期的库
pip install --upgrade pip 升级软件包,包括自己
升级之后
[root@pre-storedb03 bin]# pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (36.0.1)
根据报错
[root@pre-storedb03 .pip]# more /root/.pip/pip.conf
[list]
format=columns
[root@pre-storedb03 .pip]# pip list
Package Version
---------- -------
pip 9.0.1
setuptools 36.0.1
问题解决!
pip安装软件
pip install MySQL-python
Collecting MySQL-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 66kB/s
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... done
pip uninstall MySQL-python
[root@pre-storedb03 .pip]# pip list
Package Version
------------ -------
MySQL-python 1.2.5
pip 9.0.1
setuptools 36.0.1
1 pip下载
wget https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb --no-check-certificate
2 查看python版本
[root@pre-storedb03 soft]# python -V
Python 2.6.6
因为python的版本都2.7.13了 所以我们先把python升级了,免得pip装上用不了
3 下载python新版本
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
4 安装python
tar -zxvf Python-2.7.13.tgz
./configure --prefix=/usr/local/python
make
make install
5 创建软连接
cd /usr/bin
mv python python_bakln -s /usr/local/python27/bin/python /usr/bin/python
6 安装pip
[root@pre-storedb03 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
7 发现还需要先装setuptools
wget https://pypi.python.org/packages/a9/23/720c7558ba6ad3e0f5ad01e0d6ea2288b486da32f053c73e259f7c392042/setuptools-36.0.1.zip#md5=430eb106788183eefe9f444a300007f0
python setup.py install
回来继续安装pip
cd -
python setup.py install[root@pre-storedb03 pip-1.5.4]# pip list
-bash: pip: command not found
发现pip用不了 重新搞一下环境变量
PATH=$PATH:$HOME/bin:/usr/local/python27/bin 添加到 ~/.bash_profile
[root@pre-storedb03 bin]# pip list
pip (1.5.4)
setuptools (36.0.1)
wsgiref (0.1.2)
发现pip ok了
8 pip使用
pip list --outdated #列出所有过期的库
pip install --upgrade pip 升级软件包,包括自己
升级之后
[root@pre-storedb03 bin]# pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (36.0.1)
根据报错
[root@pre-storedb03 .pip]# more /root/.pip/pip.conf
[list]
format=columns
[root@pre-storedb03 .pip]# pip list
Package Version
---------- -------
pip 9.0.1
setuptools 36.0.1
问题解决!
pip安装软件
pip install MySQL-python
Collecting MySQL-python
Downloading MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 66kB/s
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python ... done
Successfully installed MySQL-python-1.2.5
pip安装指定好的版本的软件
pip install pycurl==7.21.5
pip uninstall MySQL-python
[root@pre-storedb03 .pip]# pip list
Package Version
------------ -------
MySQL-python 1.2.5
pip 9.0.1
setuptools 36.0.1