質問するログイン新規登録

質問編集履歴

4

追記:

2017/07/12 04:57

投稿

kohekoh
kohekoh

スコア140

title CHANGED
File without changes
body CHANGED
@@ -91,4 +91,14 @@
91
91
  http://www.geocities.jp/penguinitis2002/computer/programming/Python/cython/cython.html
92
92
 
93
93
  このサイトにライブラリのリンクのつなぎ方が書いてあるのですが
94
- どうしていいのかがわかりません
94
+ どうしていいのかがわかりません
95
+
96
+ -------------追記----------------
97
+ minwgのインストール方法
98
+
99
+ http://web.plus-idea.net/2014/06/mingw-install-2014/
100
+
101
+ このサイトの通りに実行しました
102
+ 最後のgcc --versionで確認することができたので
103
+ インストールはうまくいっていると思います
104
+ しかし、32bitか64かはわかっていません

3

情報の修正

2017/07/12 04:57

投稿

kohekoh
kohekoh

スコア140

title CHANGED
File without changes
body CHANGED
@@ -13,11 +13,76 @@
13
13
  -------------------------------------------------------
14
14
  実行結果
15
15
 
16
+ running build_ext
17
+ skipping 'cythonfn.c' Cython extension (up-to-date)
18
+ building 'calculate' extension
19
+ C:\MinGW\bin\gcc.exe -mdll -O -Wall -DMS_WIN64 "-IC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include" "-IC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include" -c cythonfn.c -o build\temp.win-amd64-3.6\Release\cythonfn.o
20
+ In file included from C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/Python.h:65:0,
21
+ from cythonfn.c:4:
22
+ C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:112:5: warning: 'struct timeval' declared inside parameter list
23
+ _PyTime_round_t round);
24
+ ^
25
+ C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:112:5: warning: its scope is only this definition or declaration, which is probably not what you want
26
+ C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\include/pytime.h:117:5: warning: 'struct timeval' declared inside parameter list
27
+ _PyTime_round_t round);
28
+ ^
29
+ writing build\temp.win-amd64-3.6\Release\calculate.cp36-win_amd64.def
30
+ C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-3.6\Release\cythonfn.o build\temp.win-amd64-3.6\Release\calculate.cp36-win_amd64.def "-LC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs" "-LC:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\PCbuild\amd64" -lpython36 -lmsvcr140 -o "C:\Users\ユーザ名\Dropbox\prg\make_tips\calculate.cp36-win_amd64.pyd"
31
+ c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../../mingw32/bin/ld.exe: C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs/python36.lib(python36.dll): Recognised but unhandled machine type (0x8664) in Import Library Format archive
32
+ C:\Users\ユーザ名\AppData\Local\conda\conda\envs\anaconda\libs/python36.lib: error adding symbols: File format not recognized
16
33
  collect2.exe: error: ld returned 1 exit status
17
34
  error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
18
35
 
19
36
  ```
37
+ また、動かしたいプログラムを以下に示します
38
+ ```python
39
+ setup.py
20
40
 
41
+ # -*- coding: utf-8 -*-
42
+
43
+ from distutils.core import setup
44
+ from distutils.extension import Extension
45
+ from Cython.Distutils import build_ext
46
+
47
+ # for notes on compiler flags e.g. using
48
+ # export CFLAGS=-O2
49
+ # so gcc has -O2 passed (even though it doesn't make the code faster!)
50
+ # http://docs.python.org/install/index.html
51
+
52
+ ext_modules = [
53
+ Extension( "calculate", ["cythonfn.pyx"] ),
54
+ ]
55
+
56
+ setup(
57
+ name = "sample calculate app" ,
58
+ cmdclass={'build_ext': build_ext },
59
+ ext_modules = ext_modules,
60
+ )
61
+
62
+ -------------------------------------------------------------------------
63
+ cythonfn.pyx
64
+
65
+ # -*- coding: utf-8 -*-
66
+
67
+ def calculate_z(maxiter, zs, cs):
68
+ """Calculate output list using Julia update rule"""
69
+ output = [0] * len(zs)
70
+ for i in range(len(zs)):
71
+ n = 0
72
+ z = zs[i]
73
+ c = cs[i]
74
+ while n < maxiter and abs(z) < 2:
75
+ z = z * z + c
76
+ n += 1
77
+ output[i] = n
78
+ return output
79
+
80
+
81
+
82
+ ```
83
+
84
+
85
+
21
86
  調べているとこれがリンクエラーのようなのですが
22
87
  どう改善していいかわかりません
23
88
  よろしくお願いします

2

追記:

2017/07/12 04:29

投稿

kohekoh
kohekoh

スコア140

title CHANGED
File without changes
body CHANGED
@@ -20,4 +20,10 @@
20
20
 
21
21
  調べているとこれがリンクエラーのようなのですが
22
22
  どう改善していいかわかりません
23
- よろしくお願いします
23
+ よろしくお願いします
24
+
25
+ ちなみに
26
+ http://www.geocities.jp/penguinitis2002/computer/programming/Python/cython/cython.html
27
+
28
+ このサイトにライブラリのリンクのつなぎ方が書いてあるのですが
29
+ どうしていいのかがわかりません

1

追記:

2017/07/12 04:13

投稿

kohekoh
kohekoh

スコア140

title CHANGED
File without changes
body CHANGED
@@ -2,6 +2,9 @@
2
2
  mingwをインストールしたのですが
3
3
  そこでつまってしまいました
4
4
 
5
+ 開発環境はanacondaで 、windows10です
6
+ python3系で動かせればうれしいです
7
+
5
8
  pythonでcythonのsetup.pyを実行しようとすると
6
9
 
7
10
  ```python