やりたいことと現状
Windows10マシンにCython環境を構築したいのですが、手順を調べてもサイトによって手順が違い混乱しています。
以下の手順で以下のエラーが発生しているので解決方法をご教示ください。
行ったこと
Python3.1.7のインストール
pip install cython
MinGW Installation Managerのインストール
MinGW Installation Managerで以下のパッケージをインストール
mingw32-base-bin
mingw32-gcc-g++-bin
環境変数のPatchにC:\MinGW\binを追加
Visual Studio Community 2017のインストール
.\Python\Python37\Lib\distutilsフォルダにdistutils.cfgファイルを作成
distutilscfg
1[build] 2compiler = mingw32
以下のpyファイルとpyxファイルをC直下に作成
setuppy
1from distutils.core import setup 2from Cython.Build import cythonize 3 4setup( 5 ext_modules = cythonize("helloworld.pyx") 6)
helloworldpyx
1print("hello")
この状態で、コマンドプロントから以下の操作を行いました。
cmd
1C:\>python setup.py build --compiler==mingw32 2running build 3running build_ext 4error: don't know how to compile C/C++ code on platform 'nt' with '=mingw32' compiler 5 6C:\>
cmd
1C:\>python setup.py build_ext --inplace 2running build_ext 3Traceback (most recent call last): 4 File "setup.py", line 5, in <module> 5 ext_modules = cythonize("helloworld.pyx") 6 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\core.py", line 148, in setup 7 dist.run_commands() 8 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 966, in run_commands 9 self.run_command(cmd) 10 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\dist.py", line 985, in run_command 11 cmd_obj.run() 12 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\command\build_ext.py", line 308, in run 13 force=self.force) 14 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\ccompiler.py", line 1031, in new_compiler 15 return klass(None, dry_run, force) 16 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\cygwinccompiler.py", line 282, in __init__ 17 CygwinCCompiler.__init__ (self, verbose, dry_run, force) 18 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\cygwinccompiler.py", line 157, in __init__ 19 self.dll_libraries = get_msvcr() 20 File "C:\Users\decoy\AppData\Local\Programs\Python\Python37\lib\distutils\cygwinccompiler.py", line 86, in get_msvcr 21 raise ValueError("Unknown MS Compiler version %s " % msc_ver) 22ValueError: Unknown MS Compiler version 1915 23 24C:\>
cmd
1 2C:\>python setup.py 3usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] 4 or: setup.py --help [cmd1 cmd2 ...] 5 or: setup.py --help-commands 6 or: setup.py cmd --help 7 8error: no commands supplied 9 10C:\Users\yuki\PycharmProjects\nuinui4x\n\t1.0>
結果、helloworld.cファイルが生成されるものの、コンパイルを行えていないようでした。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/11/11 11:00