web-dev-qa-db-ja.com

MacOS、Python:ModuleNotFoundError: 'kiwisolver'というモジュールはありません

MacOS SierraでkiwisolverをAtomでインポートしようとしましたが、見つからないというエラーが表示されます。

入力:

import kiwisolver as kiwi

出力:

Traceback (most recent call last):
File "/Users/Kev/Documents/Uvic/Python/PHYS 321B/A6Q5&6_Coupled_Oscillators_Matrix.py", line 3, in <module>
import kiwisolver as kiwi
ModuleNotFoundError: No module named 'kiwisolver'

問題は、既にインストールされていることです:

w134-87-183-190:~ Kev$ Sudo python -m pip install kiwisolver

The directory '/Users/Kev/Library/Caches/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 '/Users/Kev/Library/Caches/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 kiwisolver
Downloading kiwisolver-1.0.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (110kB)
100% |████████████████████████████████| 112kB 831kB/s 
Requirement already satisfied: setuptools in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from kiwisolver)
Installing collected packages: kiwisolver
Successfully installed kiwisolver-1.0.1

w134-87-183-190:~ Kev$ Sudo python3 -m pip install kiwisolver

The directory '/Users/Kev/Library/Caches/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 '/Users/Kev/Library/Caches/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.
Requirement already satisfied: kiwisolver in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from kiwisolver)

誰もこの問題に遭遇しましたか?この問題を解決するにはどうすればよいですか? Matplotlibを実行するために必要です。

編集:Python 3.6。

w134-87-183-190:~ Kev$ python -V
Python 2.7.10

w134-87-183-190:~ Kev$ python --version 
Python 2.7.10

w134-87-183-190:~ Kev$ python3 --version 
Python 3.6.4

Atomでは、config.csonにこれがあります。 3つのすべてのパスで同じエラーが発生します。

runner:
    scopes:
      # python: "/usr/local/bin/python3"
      # python: "/Library/Frameworks/Python.framework/Versions/3.6/Python"
      python: "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6"
8
Kevin

3時間以上の苦痛の後、解決策は非常に簡単であることが判明しました。

Kiwisolverをアンインストールします。

pip3 uninstall kiwisolver 

その後、Kiwisolverを再インストールします。

pip3 install kiwisolver
18
Kevin

Macを使用している場合は、許可の問題がある可能性があるため、これを実行してみてください。

pip3 install kiwisolver --user
1
baduker