如何在python中导入模块?

时间:2016-03-21 16:47:33

标签: python-3.x module pyautogui

我从here下载了pyautogui,但它不允许我导入它或使用它允许新python文件的任何函数,即使我在该文件中运行了安装文件写了

pip install pyautogui

import pyautogui

import module pyautogui

在python IDLE模块中。

我在python 3.4.2中这样做,我刚回来时发现错误,说它找不到。

修改

Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> pip install pyautogui
SyntaxError: invalid syntax
>>> 

"安装"以红色突出显示

1 个答案:

答案 0 :(得分:1)

尝试以下代码以使用Python安装pyautogui:-

int main()
{
    vector<int> A = {4,3,2,1,5};
    vector<int> B = {0,1,0,0,0};
    int sol = solution(A, B);
    cout << "A = {4,3,2,1,5}, B = {0,1,0,0,0}? 2: " << sol << endl;

    A = {1,0};
    B = {1,0};
    sol = solution(A, B);
    cout << "A = {1,0}, B = {1,0}? 1: " << sol << endl;

    A = {0,1};
    B = {0,0};
    sol = solution(A, B);
    cout << "A = {0,1}, B = {0,0}? 2: " << sol << endl;

    A = {0};
    B = {1};
    sol = solution(A, B);
    cout << "A = {0}, B = {1}? 1: " << sol << endl;

    A = {1};
    B = {0};
    sol = solution(A, B);
    cout << "A = {1}, B = {0}? 1: " << sol << endl;

    A = {7,4,3,2,5,6};
    B = {0,1,1,1,0,1};
    sol = solution(A, B);
    cout << "A = {7,4,3,2,5,6}, B = {0,1,1,1,0,1}? 3: " << sol << endl;

    A = {3,4,2,1,5};
    B = {1,0,0,0,0};
    sol = solution(A, B);
    cout << "A = {3,4,2,1,5}, B = {1,0,0,0,0}? 4: " << sol << endl;

    A = {1,2};
    B = {0,1};
    sol = solution(A, B);
    cout << "A = {1,2}, B = {0,1}? 2: " << sol << endl;

    A = {4,2,1,3};
    B = {1,0,1,0};
    sol = solution(A, B);
    cout << "A = {4,2,1,3}, B = {1,0,1,0}? 1: " << sol << endl;

    A = {4,3,2,5,6};
    B = {1,0,1,0,1};
    sol = solution(A, B);
    cout << "A = {4,3,2,5,6}, B = {1,0,1,0,1}? 2: " << sol << endl;

    return 0;
}

然后尝试导入库