virtualenv激活:没有命令'脚本'发现

时间:2016-03-31 06:19:44

标签: virtualenv

Ubuntu 14.04

我的virtualenv工作。但现在我无法激活它。 我得到了这个结果:

michael@michael:~$ source venv/gmv_venv/bin/activate
No command 'Script' found, did you mean:
 Command 'script' from package 'bsdutils' (main)
Script: command not found
]0: command not found
michael@michael:: command not found
]0: command not found
michael@michael:: command not found
]0: command not found
michael@michael:: command not found
]0: command not found
michael@michael:: command not found
]0: command not found
michael@michael:: command not found
[01: command not found
: command not found
[01: command not found
: command not found
[01: command not found
: command not found
[01: command not found
: command not found
: command not found
[01: command not found
: command not found
bash: venv/gmv_venv/bin/activate: line 13: syntax error near unexpected token `('

你能帮我理解我做错了什么以及如何修理。

1 个答案:

答案 0 :(得分:0)

终于解决了!

“ ./ bin / activate” 文件似乎已被覆盖
您可以使用以下脚本替换激活文件
请记住在第49行中用您的环境名称替换env名称

VIRTUAL_ENV ='/ root / env / arshad'至-> '/ root / env / your_env_name'

脚本-

library(tidymodels) 
library(baguette) # bagged trees

fid_df <- structure(list(Year = c(2015, 2015, 2015, 2015, 2015, 2015, 2015, 
                                  2015, 2015, 2015, 2015, 2015, 2016, 2016, 2016, 2016, 2016, 2016, 
                                  2016, 2016, 2016, 2016, 2016, 2016, 2017, 2017, 2017, 2017, 2017, 
                                  2017, 2017, 2017, 2017, 2017, 2017, 2017), Month = structure(c(1L, 
                                                                                                 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 
                                                                                                 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 
                                                                                                 8L, 9L, 10L, 11L, 12L), .Label = c("January", "February", "March", 
                                                                                                                                    "April", "May", "June", "July", "August", "September", "October", 
                                                                                                                                    "November", "December"), class = "factor"), Monsoon = structure(c(2L, 
                                                                                                                                                                                                      2L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 4L, 
                                                                                                                                                                                                      4L, 4L, 4L, 4L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 4L, 4L, 4L, 4L, 4L, 
                                                                                                                                                                                                      3L, 3L, 2L), .Label = c("First_Inter_Monssoon", "North_Monsoon", 
                                                                                                                                                                                                                              "Second_Inter_Monsoon", "South_Monsson"), class = "factor"), 
                         Frequency = c(36, 28, 39, 46, 5, 0, 0, 22, 10, 15, 8, 
                                       33, 33, 29, 31, 23, 8, 9, 7, 40, 41, 41, 30, 30, 44, 37, 
                                       41, 42, 20, 0, 7, 27, 35, 27, 43, 38), Days = c(31, 
                                                                                       28, 31, 30, 6, 0, 0, 29, 15, 29, 29, 31, 31, 29, 30, 30, 
                                                                                       7, 0, 7, 30, 30, 31, 30, 27, 31, 28, 30, 30, 21, 0, 7, 26, 
                                                                                       29, 27, 29, 29)), row.names = c(NA, -36L), class = "data.frame")

# split the data
fid_split <- initial_split(fid_df)

# extract the training data
fid_train <- training(fid_split)

# resample the data with 10-fold cross-validation (10-fold by default)
cv <- vfold_cv(fid_train)

##Preprocessing

rec <- recipe(Frequency ~ ., data = fid_df) %>% 
  step_nzv(all_predictors(), freq_cut = 0, unique_cut = 0) %>% # remove variables with zero variances
  step_novel(all_nominal()) %>% # prepares test data to handle previously unseen factor levels 
  step_medianimpute(all_numeric(), -all_outcomes(), -has_role("id vars"))  %>% # replaces missing numeric observations with the median
  step_dummy(all_nominal(), -has_role("id vars")) # dummy codes categorical variables


rf_spec <- rand_forest(trees = 1e3) %>%
  set_engine("ranger", importance = "permutation") %>% 
  set_mode("regression")

wflow_rf <- workflow() %>% 
  add_model(rf_spec) %>% 
  add_recipe(rec)

fit_resamples(
  wflow_rf,
  cv,
  metrics = metric_set(rmse, rsq),
  control = control_resamples(save_pred = TRUE)
)
#> 
#> Attaching package: 'rlang'
#> The following objects are masked from 'package:purrr':
#> 
#>     %@%, as_function, flatten, flatten_chr, flatten_dbl, flatten_int,
#>     flatten_lgl, flatten_raw, invoke, list_along, modify, prepend,
#>     splice
#> 
#> Attaching package: 'vctrs'
#> The following object is masked from 'package:tibble':
#> 
#>     data_frame
#> The following object is masked from 'package:dplyr':
#> 
#>     data_frame
#> # Resampling results
#> # 10-fold cross-validation 
#> # A tibble: 10 x 5
#>    splits         id     .metrics         .notes           .predictions    
#>    <list>         <chr>  <list>           <list>           <list>          
#>  1 <split [24/3]> Fold01 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  2 <split [24/3]> Fold02 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  3 <split [24/3]> Fold03 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  4 <split [24/3]> Fold04 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  5 <split [24/3]> Fold05 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  6 <split [24/3]> Fold06 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  7 <split [24/3]> Fold07 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [3 × 4]>
#>  8 <split [25/2]> Fold08 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [2 × 4]>
#>  9 <split [25/2]> Fold09 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [2 × 4]>
#> 10 <split [25/2]> Fold10 <tibble [2 × 4]> <tibble [0 × 1]> <tibble [2 × 4]>

万一这不起作用, (可能是我使用的virtualenv版本与您使用的版本不同。)
您可以通过-获取与您的版本兼容的脚本 制作一个新的虚拟virtualenv,然后将dummy_env / bin / activate文件的内容复制到your_env / bin / actiavte并将环境名称替换为your_env。