我想将我的博客(基于python3.7和django2.0)部署到服务器(centos6。)中,并创建了一个虚拟环境(基于python3.7)。安装pypi-sever后,我在终端中运行pypi-server来测试它是否有效。不幸的是,该命令不起作用。我发现了许多方法,包括update openssl,setuptools等,但是它们不起作用。
有人可以建议我还能尝试什么吗?
(pypi-env3) [root@edward pypi-env3]# pypi-server
[I 181029 20:18:20 __init__:29] Opening sqlite database: /root/virtual_path/pypi-env3/packages/metadata.db
[I 181029 20:18:20 __init__:35] Database initialized as '/root/virtual_path/pypi-env3/packages/metadata.db'. Checking migrations...
[I 181029 20:18:20 server:165] Init thread pool with 6 threads
[I 181029 20:18:20 server:194] Starting server http://127.0.0.1:8080/
[W 181029 20:18:25 iostream:1332] SSL Error on 9 ('151.101.108.223', 443): [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)
[E 181029 20:18:25 ioloop:638] Exception in callback functools.partial(<function wrap.<locals>.null_wrapper at 0x7fc60131ad08>, <tornado.concurrent.Future object at 0x7fc6013928d0>)
Traceback (most recent call last):
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/ioloop.py", line 605, in _run_callback
ret = callback()
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/stack_context.py", line 277, in null_wrapper
return fn(*args, **kwargs)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/ioloop.py", line 626, in _discard_future_result
future.result()
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 1063, in run
yielded = self.gen.throw(*exc_info)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/pypi_server/cache.py", line 194, in wrap_gen
f = gen.throw(e)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/pypi_server/handlers/pypi/proxy/client.py", line 49, in packages
(yield cls.XMLRPC.list_packages())
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/pypi_server/cache.py", line 189, in wrap_gen
res = yield f
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 1063, in run
yielded = self.gen.throw(*exc_info)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado_xmlrpc/client.py", line 111, in _remote_call
response = yield self.client.fetch(req)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/stack_context.py", line 316, in wrapped
ret = fn(*args, **kwargs)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 289, in <lambda>
future, lambda future: callback(future.result()))
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 1063, in run
yielded = self.gen.throw(*exc_info)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/tcpclient.py", line 189, in connect
server_hostname=host)
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/gen.py", line 1055, in run
value = future.result()
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/concurrent.py", line 238, in result
raise_exc_info(self._exc_info)
File "<string>", line 4, in raise_exc_info
File "/root/virtual_path/pypi-env3/lib/python3.7/site-packages/tornado/iostream.py", line 1315, in _do_ssl_handshake
self.socket.do_handshake()
File "/usr/local/lib/python3.7/ssl.py", line 1108, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)
答案 0 :(得分:-2)
我不知道您使用的是哪个模块,但是我遇到了ssl.SSLCertVerificationError错误:[SSL:CERTIFICATE_VERIFY_FAILED]证书验证失败:也无法获取本地发行者证书(_ssl.c:1045)。这就是我对导入的库请求
的处理try:
req = requests.get(i, headers=headers)
text = req.text
except requests.exceptions.SSLError as error:
print("SSL request error.", i)
pass
这是一种解决方法,但我尝试了整个pip install certifi
,但对我却没有用。