Python:ImportError:/usr/lib/python2.7/lib-dynload/_ctypes.so:未定义符号:_Py_RefTotal

时间:2018-11-21 12:19:29

标签: python python-2.7 ubuntu

我试图从源代码(./configure [params],make,sudo make install)安装Python 2.7.12和2.7.13,但它们都不起作用。脚本get-pip.py失败:

$ python get-pip.py
Traceback (most recent call last):
  File "get-pip.py", line 20890, in <module>
    main()
  File "get-pip.py", line 197, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip._internal
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/__init__.py", line 40, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/cli/autocompletion.py", line 8, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/cli/main_parser.py", line 12, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/commands/__init__.py", line 6, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/commands/completion.py", line 6, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/cli/base_command.py", line 18, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/download.py", line 38, in <module>
  File "/tmp/tmpUFyqjE/pip.zip/pip/_internal/utils/glibc.py", line 3, in <module>
  File "/usr/lib/python2.7/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ImportError: /usr/lib/python2.7/lib-dynload/_ctypes.so: undefined symbol: _Py_RefTotal

我也尝试使用apt-get安装它,但这无济于事:sudo apt-get install python-2.7sudo apt-get install python-2.7-minimal。第一个给出:python2.7 : Depends: python2.7-minimal (= 2.7.12-1ubuntu0~16.04.4) but it is not going to be installed。第二个:dpkg: error processing archive /var/cache/apt/archives/python2.7-minimal_2.7.12-1ubuntu0~16.04.4_amd64.deb (--unpack): subprocess new pre-installation script returned error exit status 1

该如何解决?系统上发生了什么问题,因此我无法对Python做任何事情。该如何调查?

0 个答案:

没有答案