2017-04-26 33 views
0

設定:win10 + vs2015(デバッグ32ビット)+ anaconda3(32ビット)それが実行C++用のpython3、実行エラー

#include <iostream> 
#include <stdio.h> 
#include <stdlib.h> 
#include <Python.h> 
#include <string.h> 

using namespace std; 

int main() 
{ 

    Py_Initialize(); 
    PyRun_SimpleString("import pylab"); 
    PyRun_SimpleString("pylab.plot(range(5))"); 
    PyRun_SimpleString("pylab.show()"); 
    Py_Exit(0); 

    return 0; 
} 

、プログラムがクラッシュ。

Crash image

+0

これは関連性がありますか? http://stackoverflow.com/questions/38132755/importerror-no-module-named-encodingsまた、このスレッドを確認してください:https://bugs.python.org/issue27054 – AndyG

+0

環境変数が正しく設定されていることを確認してください。 'PYTHONHOME'。 – zmo

答えて

0

this Python threadによると、あなたは管理者としてのPython 3.xのをインストールする必要があります。インストーラを右クリックして、管理者として実行

インストール後に環境変数を確認して、インストールされたモジュールが見つかる場所にPYTHONPATHPYTHONHOMEが設定されていることを確認してください。

+0

pythonhomeとpythonpathは問題ありません。とにかく、私は再び失敗しました。私はpython2を使用して、私はそれを作る。 – LaoJiu

関連する問題