python常见报错以及解决方案

python及相关工具安装Error集
1. 如果升级python版本中出现error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
解决方法: vim /etc/ld.so.conf
添加:/usr/local/lib
执行:/sbin/ldconfig -v
2. 如果出现unknown url type: https
解决方法:安装openssl-devel
3. 出现numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
解决办法:安装atlas atlas-devel.x86_64
4. 出现 Failedto build these modules:    binascii    zlib
解决办法:安装zlib并重新编译python
5. 安装numpy报错RuntimeError: Running cythonize failed!
解决办法:编译安装cython
6. 出现error: library dfftpack has Fortran sources but no Fortran compiler found
解决办法:安装 gcc-gfortran.x86_64
7. 出现ImportError: No module named bz2:
解决办法:yum install -y bzip2*cd ../Python-2.7.3/Modules/zlib./configuremakemake installcd ../../python setup.py install重新编译python
8. 出现ImportError: libpython2.7.so.1.0: cannot open shared object file: No such file or directory
解决办法:编译时只有加上--enable-shared,才会编译这个共享库,默认的位置是python可执行程序所在目录的lib目录下,如/usr/local/python2.7.4

9、site-packages/pkg_resources.py:1031: UserWarning:

import MySQLdb

有可能报:site-packages/pkg_resources.py:1031: UserWarning: /home/***/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).

修改方式给.python-eggs加权限:chmod g-wx,o-wx .python-eggs/


10、常见问题:Microsoft Visual C++ 9.0 is required

解决方案:

安装Microsoft Visual C++ Compiler for Python 2.7
download : https://www.microsoft.com/en-us/download/confirmation.aspx?id=44266
在Windows7x64下报错:Microsoft Visual C++ 9.0 is required  (Unable to find vcvarsall.bat)
环境:windows7 x64 ,python2.7 ,VS2012
原因:windows下使用pip安装包的时候需要机器装有vs2008,VS2012还不行,如果不想装VS2008的话,可以安装一个Micorsoft Visual C++ Compiler for Python 2.7的包

你可能感兴趣的:(python等脚本)