天天看点

python 环境问题

1. 查看python安装的依赖包及版本

$pip freeze
Babel==2.1.1
Flask==0.10.1
Flask-HTTPAuth==2.6.0
Flask-RESTful==0.3.4
Flask-SQLAlchemy==2.0
Impacket==0.9.6.0
Jinja2==2.8      

2. python 批量安装依赖包

安装清单如1中所列举

sudo pip install -r requirement.txt      

忽略异常强制安装

sudo pip install -r requirement.txt --force      

3. python 版本升级

yum search python*
yum search python27
sudo yum install tops-python27      

4. 查看python 配置文件位置

$whereis python
python: /usr/bin/python2.6 /usr/bin/python2.6-config      

5. 查看geos及shapely依赖的GEOS版本

>>> from shapely.geos import geos_version_string, geos_version
>>> geos_version_string
'3.6.1-CAPI-1.10.1 r0'
>>> geos_version

>>> import geos
>>> geos.GEOS_VERSION
'3.6.1'      

6. 安装libspatialindex_c

Rtree and a missing libspatialindex_c library file

brew install spatialindex      

7. 安装制定版本依赖包

pip install matplotlib==1.3.1