小编SFC*_*SFC的帖子

无法运行Python脚本CRON:导入错误:没有名为Tweepy的模块

背景:我正在跟踪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似乎没读过它时。有什么建议吗?

python unix terminal cron tweepy

4
推荐指数
1
解决办法
4815
查看次数

ValueError:n_splits = 10不能大于每个类中的成员数

我试图运行以下代码:

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)) …

python scikit-learn cross-validation

3
推荐指数
1
解决办法
7484
查看次数

标签 统计

python ×2

cron ×1

cross-validation ×1

scikit-learn ×1

terminal ×1

tweepy ×1

unix ×1