virt-manager-ImportError:没有名为ordered_dict的模块

时间:2018-12-13 17:17:46

标签: python-3.x python-2.7 kvm ikvm

我有KVM服务器,它具有python2.7版本。现在,连同python2.7一样,已经安装了python3。现在,如果我尝试执行virt-manager,则会出现以下错误:

from .packages.urllib3.packages.ordered_dict import ordered_dict
ImportError: No module named ordered_dict

如果我删除python3,它将影响其他2.7软件包/库吗?

2 个答案:

答案 0 :(得分:0)

在我的情况下,使用

的Ubuntu Xenial
sudo pip uninstall urllib3

虚拟经理再次工作

答案 1 :(得分:-1)

请按照以下步骤解决问题。

public class TranslateText extends AppCompatActivity {
TextView TText;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_translate_text);
    TText = findViewById(R.id.TranslatedView);

}

public static void main(String[] args) throws IOException {
    String text = "Hello world!";
    System.out.println("Translated text: " + translate("en", "zh-CN",text));
}

private static String translate(String langFrom, String langTo, String text) throws IOException {

    String urlStr = "https://script.google.com/macros/s/AKfycbzjyCsF9eoo7MR38wVg0WFU9oxc9I2aU4Bt4YPEiqtRLJLx0XU/exec" +
            "?q=" + URLEncoder.encode(text, "UTF-8") +
            "&target=" + langTo +
            "&source=" + langFrom;
    URL url = new URL(urlStr);
    StringBuilder response = new StringBuilder();
    HttpURLConnection con = (HttpURLConnection) url.openConnection();
    con.setRequestProperty("User-Agent", "Mozilla/5.0");
    BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
    String inputLine;
    while ((inputLine = in.readLine()) != null) {
        response.append(inputLine);
    }
    in.close();
    return response.toString();
}