我用raspi做了一个红绿灯原型。我的源代码给出了一个错误。错误的人说
Traceback (most recent call last):
File "/home/pi/testing.py", line 2, in <module>
import skfuzzy as fuzz
ImportError: No module named 'skfuzzy'
我已经检查过scikit-fuzzy已经安装在我的raspi上了,但是每当我运行的时候,源代码都无法识别出scikit-fuzzy工具。
下面是我的一些源代码:
import numpy as np
import skfuzzy as fuzz
import RPi.GPIO as GPIO
import time
Curr_GtGB=40
Curr_GtSU=46
Curr_GtSS=26
Curr_GtK=12
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
redGB=16
yelGB=18
grenGB=22
redSU=40
yelSU=38
grenSU=36
redSS=33
yelSS=35
grenSS=37
redK=11
yelK=13
grenK=15
GPIO.setup(redGB, GPIO.OUT)
GPIO.setup(yelGB, GPIO.OUT)
GPIO.setup(grenGB, GPIO.OUT)
GPIO.setup(redSU, GPIO.OUT)
GPIO.setup(yelSU, GPIO.OUT)
GPIO.setup(grenSU, GPIO.OUT)
GPIO.setup(redSS, GPIO.OUT)
GPIO.setup(yelSS, GPIO.OUT)
GPIO.setup(grenSS, GPIO.OUT)
GPIO.setup(redK, GPIO.OUT)
GPIO.setup(yelK, GPIO.OUT)
GPIO.setup(grenK, GPIO.OUT)
发布于 2018-05-16 20:57:23
对于我来说,同样的错误也会出现。
但是下面的命令解决了这个问题(转到命令行并输入):
pip install -U scikit-fuzzy
这应该是可行的。
发布于 2019-02-12 21:45:18
@ShaliniBaranwal是正确答案
对于python3,遵循以下命令
sudo pip3 install -U scikit fuzzy
此外,正如@hiwansandhi所评论的那样,请遵循link pythonhosted.org/scikit-fuzzy/install.html和scikits.apppot.com/scikit-fuzzy上的说明
这些对于使用easy_install和pip安装scikit-fuzzy非常有用。
sudo pip3 install -U scikit fuzzy
本文还介绍了如何从源代码进行安装
发布于 2020-08-31 15:32:22
因此,对我起作用的是(我使用python3):
pip uninstall scikit-fuzzy scipy numpy networkx decorator
pip3 uninstall scikit-fuzzy scipy numpy networkx decorator
pip3 install -U scikit-fuzzy
然后关闭并再次打开IDE (对我来说就是Spyder)
https://stackoverflow.com/questions/48162712
复制相似问题