我有一个.pyx模块,我一直试图通过各种方式在Windows上使用64位python 3.4进行编译但没有成功.
经过大量的试验和错误,它确实编译
python setup.py build_ext --inplace --compiler=mingw32
Run Code Online (Sandbox Code Playgroud)
但是,当然,这不适用于64位python.
使用msvc作为编译器,错误是
File "C:\Python34\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']
Run Code Online (Sandbox Code Playgroud)
不受distutils影响的解决方案也是受欢迎的.
---编辑:附加信息
我现在根据http://bugs.python.org/issue11723修改了distutils以识别mingw-w64 .然后我使用gendef和dlltool制作了libpython34.a,但是收到错误
c:\Python34\libs/libpython34.a: file not recongnized: File truncated
Run Code Online (Sandbox Code Playgroud)
跑步的时候
python setup.py build_ext --inplace --compiler=mingw64
Run Code Online (Sandbox Code Playgroud) 请原谅标题中任何令人困惑的术语,但想象一下我想要一个小宏来标记我创建的结构可用于某些恶意目的。我写了这个小模块:
module Usable
export @usable, isusable
isusable(::Type{T}) where T = false
macro usable(expr::Expr)
name = expr.args[2]
return quote
$expr
Usable.isusable(::Type{$name}) = true # This in't working
end
end
end
Run Code Online (Sandbox Code Playgroud)
但是,尝试使用我的宏
julia> include("Usable.jl")
Main.Usable
julia> using Main.Usable
julia> @usable struct Foo
bar::String
end
Run Code Online (Sandbox Code Playgroud)
结果是
ERROR: UndefVarError: Foo not defined
Run Code Online (Sandbox Code Playgroud)
该结构显然定义得很好
julia> Foo("soup")
Foo("soup")
Run Code Online (Sandbox Code Playgroud)
所以看起来这个定义比我预期的要早。我显然错过了一些东西,但我无法弄清楚是什么。
如果我创建一个新项目
lein new quil foo
Run Code Online (Sandbox Code Playgroud)
然后将 src/foo/core.clj 减少到
(ns foo.core
(:require [quil.core :as q]
[quil.middleware :as m]))
(defn draw [state]
(if (< (rand) 0.5)
(q/line 0 0 500 500)
(q/line 0 500 500 0)))
(q/defsketch foo
:title "Try this at home"
:size [500 500]
:draw draw
:features [:keep-on-top]
:middleware [m/fun-mode])
Run Code Online (Sandbox Code Playgroud)
在评估程序lein repl与(use 'foo.core),无论是画线(即我得到一个大的X)。(if (< (rand) 0.5) true false)按预期工作,那么我错过了什么?