我得到的是ModuleNotFoundError:ubuntu18.04上没有名为_socket的模块

2024-05-01 04:10:55 发布

您现在位置:Python中文网/ 问答频道 /正文

我在ubuntu上安装了Anaconda3,并在.bashrc文件中将路径改为~/anaconda/bin,然后我试图安装keras,它抛出了这个错误。在

hemanth@specter:~$ python3 -m pip install keras
Traceback (most recent call last):
  File "/home/hemanth/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/home/hemanth/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/__main__.py", line 16, in <module>
    from pip._internal import main as _main  # isort:skip # noqa
  File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_internal/__init__.py", line 19, in <module>
    from pip._vendor.urllib3.exceptions import DependencyWarning
  File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/__init__.py", line 8, in <module>
    from .connectionpool import (
  File "/home/hemanth/anaconda3/lib/python3.7/site-packages/pip/_vendor/urllib3/connectionpool.py", line 7, in <module>
    from socket import error as SocketError, timeout as SocketTimeout
  File "/home/hemanth/anaconda3/lib/python3.7/socket.py", line 49, in <module>
    import _socket
ModuleNotFoundError: No module named '_socket'

Tags: pipinpyimporthomemainlibpackages