试图在ubuntu 16.04 LTS上安装arosics(https://pypi.python.org/pypi/arosics/0.8.2)。
当我这样做时:

~$ sudo pip install arosics

然后我得到:
The directory '/home/user/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/user/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting arosics
  Downloading arosics-0.8.4.tar.gz (21.9MB)
    100% |################################| 21.9MB 32kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-PRYU7V/arosics/setup.py", line 8, in <module>
        from importlib import util
    ImportError: cannot import name util

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-PRYU7V/arosics/

也尝试过:
sudo -H pip install arosics
Collecting arosics
  Downloading arosics-0.8.4.tar.gz (21.9MB)
    100% |################################| 21.9MB 23kB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-cTU5Br/arosics/setup.py", line 8, in <module>
        from importlib import util
    ImportError: cannot import name util

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-cTU5Br/arosics/

我不知道出了什么事。我试着pip install python-util但是在那之后我一直得到上面同样的错误。
请问如何进行?

最佳答案

Arosics目前只对蟒蛇3有效。from importutil import util在Python2.7下不起作用,因为它不受支持。
如果换成蟒蛇3是个不错的选择。否则,必须修改arosics项目的setup.py。
我成功地安装了sudo pip3 install arosics

关于python - ImportError:尝试在ubuntu上安装arosics时,无法导入名称util,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/49164347/

10-08 21:47