首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >pip、SSLException的问题

pip、SSLException的问题
EN

Stack Overflow用户
提问于 2018-09-10 05:57:01
回答 1查看 365关注 0票数 -1

编辑:我得到了安装pip和pyserial的帮助,但导入序列在我的项目中不起作用。更好的解释在我的帖子的末尾。

我正在尝试为一个学校项目安装pyserial。

无论如何,我尝试了很多不同的方法,但都没有奏效。当我写的时候

代码语言:javascript
复制
> python3 -m pip search pyserial

我得到了这个例外:

代码语言:javascript
复制
> Exception: Traceback (most recent call last):   File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py",
> line 544, in urlopen
>     body=body, headers=headers)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py",
> line 341, in _make_request
>     self._validate_conn(conn)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py",
> line 761, in _validate_conn
>     conn.connect()   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/connection.py",
> line 238, in connect
>     ssl_version=resolved_ssl_version)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py", line 279, in ssl_wrap_socket
>     return context.wrap_socket(sock, server_hostname=server_hostname)   File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py",
> line 376, in wrap_socket
>     _context=self)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py",
> line 747, in __init__
>     self.do_handshake()   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py",
> line 983, in do_handshake
>     self._sslobj.do_handshake()   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py",
> line 628, in do_handshake
>     self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
> (_ssl.c:645)
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):   File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/adapters.py",
> line 370, in send
>     timeout=timeout   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/packages/urllib3/connectionpool.py",
> line 574, in urlopen
>     raise SSLError(e) pip._vendor.requests.packages.urllib3.exceptions.SSLError: [SSL:
> TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
> (_ssl.c:645)
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):   File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/basecommand.py",
> line 211, in main
>     status = self.run(options, args)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/commands/search.py",
> line 43, in run
>     pypi_hits = self.search(query, options)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/commands/search.py",
> line 60, in search
>     hits = pypi.search({'name': query, 'summary': query}, 'or')   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xmlrpc/client.py",
> line 1091, in __call__
>     return self.__send(self.__name, args)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/xmlrpc/client.py",
> line 1431, in __request
>     verbose=self.__verbose   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/download.py",
> line 785, in request
>     headers=headers, stream=True)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py",
> line 508, in post
>     return self.request('POST', url, data=data, json=json, **kwargs)   File
> "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/download.py",
> line 373, in request
>     return super(PipSession, self).request(method, url, *args, **kwargs)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py",
> line 465, in request
>     resp = self.send(prep, **send_kwargs)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/sessions.py",
> line 573, in send
>     r = adapter.send(request, **kwargs)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/cachecontrol/adapter.py",
> line 46, in send
>     resp = super(CacheControlAdapter, self).send(request, **kw)   File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pip/_vendor/requests/adapters.py",
> line 431, in send
>     raise SSLError(e, request=request) pip._vendor.requests.exceptions.SSLError: [SSL:
> TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version
> (_ssl.c:645)

有没有人对我能做什么有什么建议?

谢谢你的帮助!

多亏了大家的帮助,我想我已经接近修复它了。我现在可以在编写代码时找到pyserial。

pip列表

但是,当我尝试将其导入到python文件中时,我得到的结果是:

ImportError:没有名为'serial‘的模块

除了在终端安装之外,在项目中使用还需要做什么吗?有没有可能我安装它是为了在Python 2中使用,而不是在我正在使用的Python 3中使用?

EN

回答 1

Stack Overflow用户

发布于 2018-09-10 06:05:29

使用以下命令在Mac上安装pip:

代码语言:javascript
复制
easy_install pip

如果您需要管理员权限才能运行此命令,请尝试:

代码语言:javascript
复制
sudo easy_install pip

请使用以下命令来安装pyserial:

代码语言:javascript
复制
pip install pyserial

我希望这能帮到你。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52248950

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档