【python】安装python3.7出现ModuleNotFoundError: No module named ‘_ctypes’解决办法

ModuleNotFoundError: No module named ‘_ctypes’

    
    
    
    
  1. Traceback (most recent call last) :
  2. File "/home/wfq/soft/Python-3.7.0b3/Lib/runpy.py", line 193, in _run_module_as_main
  3. "__main__", mod_spec)
  4. File "/home/wfq/soft/Python-3.7.0b3/Lib/runpy.py", line 85, in _run_code
  5. exec(code, run_globals)
  6. File "/home/wfq/soft/Python-3.7.0b3/Lib/ensurepip/__main__.py", line 5, in < module>
  7. sys.exit(ensurepip._main())
  8. File "/home/wfq/soft/Python-3.7.0b3/Lib/ensurepip/__init__.py", line 204, in _main
  9. default_pip=args.default_pip,
  10. File "/home/wfq/soft/Python-3.7.0b3/Lib/ensurepip/__init__.py", line 117, in _bootstrap
  11. return _run_pip(args + [p[ 0] for p in _PROJECTS], additional_paths)
  12. File "/home/wfq/soft/Python-3.7.0b3/Lib/ensurepip/__init__.py", line 27, in _run_pip
  13. import pip
  14. File "/tmp/tmpnfe1bbxk/pip-9.0.3-py2.py3-none-any.whl/pip/__init__.py", line 45, in < module>
  15. File "/tmp/tmpnfe1bbxk/pip-9.0.3-py2.py3-none-any.whl/pip/vcs/mercurial.py", line 9, in < module>
  16. File "/tmp/tmpnfe1bbxk/pip-9.0.3-py2.py3-none-any.whl/pip/download.py", line 36, in < module>
  17. File "/tmp/tmpnfe1bbxk/pip-9.0.3-py2.py3-none-any.whl/pip/utils/glibc.py", line 4, in < module>
  18. File "/home/wfq/soft/Python-3.7.0b3/Lib/ctypes/__init__.py", line 7, in < module>
  19. from _ctypes import Union, Structure, Array
  20. ModuleNotFoundError : No module named '_ctypes'
  21. make: *** [install] Error 1

解决方法:


    
    
    
    
  1. sudo apt -get update
  2. sudo apt -get upgrade
  3. sudo apt -get dist -upgrade
  4. sudo apt -get install build -essential python -dev python -setuptools python -pip python -smbus
  5. sudo apt -get install build -essential libncursesw5 -dev libgdbm -dev libc6 -dev
  6. sudo apt -get install zlib1g -dev libsqlite3 -dev tk -dev
  7. sudo apt -get install libssl -dev openssl
  8. sudo apt -get install libffi -dev

再重新编译安装python3.7即可成功 。

原问题:https://stackoverflow.com/questions/27022373/python3-importerror-no-module-named-ctypes-when-using-value-from-module-mul

转https://blog.csdn.net/sinat_36184075/article/details/80155392

你可能感兴趣的:(挨踢技术)