古董python2.7,最近又写了几个程序,需要用到pymysql 连接MySQL数据库,但是一直出现一个警告提示,看着烦。
/usr/lib/python2.7/site-packages/PyInstaller/loader/pyimod03_importers.py:395: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in the next release.
意思是将在未来版本不支持Python 2,但是我这生产环境,又不能升级。
网上说安装低版本的cryptography,比如
pip install cryptography==2.6 但是我这里好像没找到2.6的版本。
看到另一个直接修改代码,把警告去掉。
修改 /usr/lib64/python2.7/site-packages/cryptography/__init__.py
在最后面把版本判断注释掉
#if sys.version_info[0] == 2: # warnings.warn( # "Python 2 is no longer supported by the Python core team. Support for " # "it is now deprecated in cryptography, and will be removed in the " # "next release.", # CryptographyDeprecationWarning, # stacklevel=2, # )
Windows 路径 C:\python2.7\Lib\site-packages\cryptography\__init__.py
根据自己安装的路径修改。
转载请注明:果果.IT » 解决python CryptographyDeprecationWarning提示版本低不再支持问题