-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
之前Taichi运行正常,突然就没法运行了。显示错误: ti.init(arch=ti.gpu) AttributeError: module 'taichi' has no attribute 'init' #2072
Comments
你的文件名是不是taichi.py? |
不是,我的文件名是2.py |
你的太极版本是多少?能否试试看以下三行代码:
import taichi as ti
print(dir(ti))
print(ti.__file__, ti.__version__)
并告诉我结果?
双笙子佯谬
1931127624@qq.com
上海拆桥学院
桥梁爆破小组首席执行官
…------------------ 原始邮件 ------------------
发件人: "notifications"<notifications@github.com>;
发送时间: 2020年12月1日(星期二) 上午9:57
收件人: "taichi-dev/taichi"<taichi@noreply.github.com>;
抄送: "双笙子佯谬"<1931127624@qq.com>; "Comment"<comment@noreply.github.com>;
主题: Re: [taichi-dev/taichi] 之前Taichi运行正常,突然就没法运行了。显示错误: ti.init(arch=ti.gpu) AttributeError: module 'taichi' has no attribute 'init' (#2072)
不是,我的文件名是2.py
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
输出结果:['builtins', 'cached', 'doc', 'file', 'loader', 'name', 'package', 'path', 'spec'] 我的taichi版本为0.7.9 |
同一个文件夹中有没有taichi.py或者名为taichi的目录?python会优先从当前目录搜索模块。
双笙子佯谬
1931127624@qq.com
上海拆桥学院
桥梁爆破小组首席执行官
…------------------ 原始邮件 ------------------
发件人: "notifications"<notifications@github.com>;
发送时间: 2020年12月1日(星期二) 上午9:57
收件人: "taichi-dev/taichi"<taichi@noreply.github.com>;
抄送: "双笙子佯谬"<1931127624@qq.com>; "Comment"<comment@noreply.github.com>;
主题: Re: [taichi-dev/taichi] 之前Taichi运行正常,突然就没法运行了。显示错误: ti.init(arch=ti.gpu) AttributeError: module 'taichi' has no attribute 'init' (#2072)
不是,我的文件名是2.py
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
|
['E:\python program\taichi'] |
把这个文件夹重命名为其他任何名字试试?比如`E:\python program\taichi demo`
双笙子佯谬
1931127624@qq.com
上海拆桥学院
桥梁爆破小组首席执行官
…------------------ 原始邮件 ------------------
发件人: "notifications"<notifications@github.com>;
发送时间: 2020年12月1日(星期二) 中午12:46
收件人: "taichi-dev/taichi"<taichi@noreply.github.com>;
抄送: "双笙子佯谬"<1931127624@qq.com>; "Comment"<comment@noreply.github.com>;
主题: Re: [taichi-dev/taichi] 之前Taichi运行正常,突然就没法运行了。显示错误: ti.init(arch=ti.gpu) AttributeError: module 'taichi' has no attribute 'init' (#2072)
['E:\python program\taichi']
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
问题解决了,我把文件夹换了个名称就能运行了,谢谢! |
不是,我的文件名是3.py
…---原始邮件---
发件人: "彭于斌"<notifications@github.com>
发送时间: 2020年11月30日(周一) 晚上11:49
收件人: "taichi-dev/taichi"<taichi@noreply.github.com>;
抄送: "ben100118"<1501037322@qq.com>;"Author"<author@noreply.github.com>;
主题: Re: [taichi-dev/taichi] 之前Taichi运行正常,突然就没法运行了。显示错误: ti.init(arch=ti.gpu) AttributeError: module 'taichi' has no attribute 'init' (#2072)
你的文件名是不是taichi.py?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I have the same problems, and I have checked the filename and path Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import taichi as ti
>>> ti.__path__
_NamespacePath(['/home/username/.local/lib/python3.6/site-packages/taichi'])
>>> ti.init(ti.cpu)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'taichi' has no attribute 'init'
>>> ti.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'taichi' has no attribute '__version__'
>>> dir(ti)
['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__']
>>> ti.__name__
'taichi' |
would you mind check 'home/username/.local/lib/python3.6/site-packages/taichi' if it's an empty folder?
无法顺畅的大口呼吸,是活着的最好证明
…---原始邮件---
发件人: ***@***.***>
发送时间: 2021年8月5日(周四) 晚上9:31
收件人: ***@***.***>;
抄送: ***@***.******@***.***>;
主题: Re: [taichi-dev/taichi] 之前Taichi运行正常,突然就没法运行了。显示错误: ti.init(arch=ti.gpu) AttributeError: module 'taichi' has no attribute 'init' (#2072)
我也碰到同意的问题,检查了文件名和路径
Python 3.6.9 (default, Jan 26 2021, 15:33:00) [GCC 8.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import taichi as ti >>> ti.__path__ _NamespacePath(['/home/username/.local/lib/python3.6/site-packages/taichi']) >>> ti.init(ti.cpu) Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'taichi' has no attribute 'init' >>> ti.__version__ Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: module 'taichi' has no attribute '__version__' >>> dir(ti) ['__doc__', '__loader__', '__name__', '__package__', '__path__', '__spec__'] >>> ti.__name__ 'taichi'
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Yes, the folder is not empty, the content is as follow:
|
Sorry, please keep using 0.7.26 for now until #2642 gets resolved. Thanks! |
Thanks for the reply, 0.7.26 works for me. |
import taichi as ti
ti.init(arch=ti.gpu)
n=320
pixels=ti.var(dt=ti.f32,shape=(n*2,n))
@ti.func
def complex_sqr(z):
return ti.Vector([z[0]**2-z[1]**2,z[1]*z[0]*2])
@ti.kernel
def paint(t:ti.f32):
for i,j in pixels:
c=ti.Vector([-0.8,ti.cos(t)*0.2])
z=ti.Vector([i/n-1,j/n-0.5])2
iterations=0
while z.norm() <20 and iterations < 50:
z=complex_sqr(z)+c
iterations+=1
pixels[i,j]=1-iterations0.02
gui=ti.GUI("Julia Set",res=(n*2,n))
for i in range(1000000):
paint(i*0.03)
gui.set_image(pixels)
gui.show()
The text was updated successfully, but these errors were encountered: