[英]pycharm numpy/tensorflow error
I am importing both tf and np in pycharm. 我正在pycharm中同时导入tf和np。 tf version of 1.6.0 and numpy version of 1.14.1. TF版本为1.6.0,numpy版本为1.14.1。 I keep running into this error. 我一直遇到这个错误。 Please help - 请帮忙 -
Traceback (most recent call last):
File "<path>PycharmProjects/testflow/testflow.py", line 1, in <module>
import numpy as np
File "<path>PycharmProjects/testflow/venv/lib/python3.5/site-packages/numpy/__init__.py", line 166, in <module>
from . import random
File "<path>/PycharmProjects/testflow/venv/lib/python3.5/site-packages/numpy/random/__init__.py", line 99, in <module>
from .mtrand import *
File "type.pxd", line 9, in init mtrand
ValueError: builtins.type has the wrong size, try recompiling. Expected 840, got 864
Process finished with exit code 1
The code is very simple - 代码很简单-
import numpy as np
import tensorflow as tf
a = tf.constant([1, 2, 3], name='myname')
print (a)
with tf.Session() as sess:
print (sess.run(a))
b = np.array([1,2,3])
print (b)
It looks as if the imports are just a little messed up from that tiny snippet. 似乎进口商品只是从那个小片段中弄得一团糟。 Try something like the following: 尝试如下操作:
import numpy as np
from numpy import random
from numpy.random import mtrand
i = random.rand() # Can omit the np in np.random()
j = mtrand.bytes(5) # Can omit the np.random in np.random.mtrand.bytes(5)
print(i)
print(j)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.