ImportError: No module named distutils

吃可爱长大的小学妹 提交于 2019-12-10 13:44:24

问题


Attempt to install psutils resulted a big headache...

$ python -V
Python 2.4.2

$ cat /etc/SuSE-release
SUSE Linux Enterprise Server 10 (x86_64)
VERSION = 10
PATCHLEVEL = 4


$ cd psutil-2.1.1/
$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 17, in ?
    from distutils.core import setup, Extension
ImportError: No module named distutils.core

Next - I try to install setuptools to use easy_install:

$ which easy_install
which: no easy_install

$ cd ../setuptools-1.4/

$ python setup.py install
Traceback (most recent call last):
  File "setup.py", line 12, in ?
    from distutils.util import convert_path
ImportError: No module named distutils.util

Trying install distutils from ez_setup.py:

$ python ez_setup.py
Traceback (most recent call last):
  File "ez_setup.py", line 278, in ?
    main(sys.argv[1:])
  File "ez_setup.py", line 210, in main
    egg = download_setuptools(version, delay=0)
  File "ez_setup.py", line 139, in download_setuptools
    from distutils import log
ImportError: No module named distutils

So - how can I install it?

P.S. No, I haven't root on this machine and can't use package manager.


回答1:


you need to run this (if Error happens on python3) ==> sudo apt-get install python3-distutils --reinstall

you need to run this (if Error happens on python2) ==> sudo apt-get install python2-distutils --reinstall



来源:https://stackoverflow.com/questions/23626034/importerror-no-module-named-distutils

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!