@TOC
问题描述
openssl导致涉及到联网的部分出现问题。
# pip uninstall pip
Traceback (most recent call last):
File "/data/minianaconda3/bin/pip", line 11, in <module>
sys.exit(main())
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_internal/cli/main.py", line 73, in main
command = create_command(cmd_name, isolated=("--isolated" in cmd_args))
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_internal/commands/__init__.py", line 96, in create_command
module = importlib.import_module(module_path)
File "/data/minianaconda3/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_internal/commands/uninstall.py", line 9, in <module>
from pip._internal.cli.req_command import SessionCommandMixin
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_internal/cli/req_command.py", line 15, in <module>
from pip._internal.index.package_finder import PackageFinder
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_internal/index/package_finder.py", line 21, in <module>
from pip._internal.index.collector import parse_links
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_internal/index/collector.py", line 12, in <module>
from pip._vendor import html5lib, requests
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_vendor/requests/__init__.py", line 97, in <module>
from pip._vendor.urllib3.contrib import pyopenssl
File "/data/minianaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/contrib/pyopenssl.py", line 46, in <module>
import OpenSSL.SSL
File "/data/minianaconda3/lib/python3.7/site-packages/OpenSSL/__init__.py", line 8, in <module>
from OpenSSL import crypto, SSL
File "/data/minianaconda3/lib/python3.7/site-packages/OpenSSL/crypto.py", line 1517, in <module>
class X509StoreFlags(object):
File "/data/minianaconda3/lib/python3.7/site-packages/OpenSSL/crypto.py", line 1535, in X509StoreFlags
NOTIFY_POLICY = _lib.X509_V_FLAG_NOTIFY_POLICY
AttributeError: module 'lib' has no attribute 'X509_V_FLAG_NOTIFY_POLICY'
解决
删除报错的openssl
rm -rf /data/minianaconda3/lib/python3.7/site-packages/OpenSSL
重装openssl
sudo yum install python-pip # 不要这个
sudo yum install python3-pip
pip install openssl