python-3.x 无法在Debian(Raspbian)上安装psutil

qyzbxkaa  于 2023-03-20  发布在  Python
关注(0)|答案(1)|浏览(134)

我正在尝试在我的Raspbian VM上安装psutil,我正在那里处理python代码,稍后我打算将它上传到pi。
每次当我尝试安装psutil时,它都会给出以下错误。

pi@raspberry:~ $ pip3 install psutil
Collecting psutil
Exception:
Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 138, in _new_conn
    (self.host, self.port), self.timeout, **extra_kw)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/util/connection.py", line 75, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "/usr/lib/python3.5/socket.py", line 733, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 594, in urlopen
    chunked=chunked)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 350, in _make_request
    self._validate_conn(conn)
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 837, in _validate_conn
    conn.connect()
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 281, in connect
    conn = self._new_conn()
  File "/usr/share/python-wheels/urllib3-1.19.1-py2.py3-none-any.whl/urllib3/connection.py", line 147, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0xb6066dac>: Failed to establish a new connection: [Errno -2] Name or service not known

我做了一些研究,并意识到我需要安装'python-dev',但它没有帮助。

pi@raspberry:~ $ sudo apt-get install python3-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-dev is already the newest version (3.5.3-1).
python3-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

任何帮助都将不胜感激。谢谢。

kd3sttzy

kd3sttzy1#

您应该安装python3-dev

sudo apt-get install python3-dev

相关问题