背景:我正在跟踪Crontab不在运行我的python脚本,以尝试使用CRON调试和运行我的python脚本。根据SO的建议,我尝试/usr/bin/python /Users/eer/Desktop/myscript.py在终端上。
问题:但是,出现错误:ImportError: No module named tweepy。所以,我想pip install tweepy,我得到如下:Requirement already satisfied: tweepy in /Users/eer/anaconda/lib/python2.7/site-packages。因此,我似乎有些蠕动,但当我/usr/bin/python /Users/eer/Desktop/myscript.py似乎没读过它时。有什么建议吗?
我试图运行以下代码:
from sklearn.model_selection import StratifiedKFold
X = ["hey", "join now", "hello", "join today", "join us now", "not today", "join this trial", " hey hey", " no", "hola", "bye", "join today", "no","join join"]
y = ["n", "r", "n", "r", "r", "n", "n", "n", "n", "r", "n", "n", "n", "r"]
skf = StratifiedKFold(n_splits=10)
for train, test in skf.split(X,y):
print("%s %s" % (train,test))
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
ValueError: n_splits=10 cannot be greater than the number of members in each class.
Run Code Online (Sandbox Code Playgroud)
我在这里看了scikit-learn错误:y中人口最少的类只有1个成员,但我仍然不确定我的代码有什么问题.
我的名单都有14个长度print(len(X)) print(len(y)) …