簡體   English   中英

MacOS,Python:ModuleNotFoundError:沒有名為'kiwisolver'的模塊

[英]MacOS, Python: ModuleNotFoundError: No module named 'kiwisolver'

我試圖在MacOS Sierra上的Atom中導入kiwisolver,我得到錯誤它沒有找到:

輸入:

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中有這個。 所有三個路徑都給出了相同的錯誤:

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"

經過3個多小時的痛苦,解決方案變得非常簡單。

卸載Kiwisolver:

pip3 uninstall kiwisolver 

然后重新安裝Kiwisolver:

pip3 install kiwisolver

如果你在Mac上嘗試運行它,因為你可能有一些權限問題:

pip3 install kiwisolver --user

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM