我尝试运行附加的代码,并弹出附加的错误。 我尝试通过pycharm和scikit来运行代码,而tensorflow是 installed。
我试图按照评论的建议执行python setup.py install
,
C:\ Users \ nirkov \ AppData \ Roaming \ Python \ Python36 \ site-packages \ sklearn \ __ check_build
那并不能解决问题。我在执行命令的地方错了吗?
有人知道这个问题可能是什么吗? (我当时正在网上寻找此问题,但不幸的是我无法解决该问题)
代码-
import numpy as np
import tensorflow as tf
from sklearn.datasets import fetch_california_housing
housing = fetch_california_housing()
m, n = housing.data.shape
housing_data_plus_bias = np.c_[np.ones((m,1)),housing.data]
X = tf.constant(housing_data_plus_bias, dtype=tf.float32, name="X")
Y = tf.constant(housing.target.reshape(-1,1), dtype=tf.float32, name="Y")
X_Transpose = tf.transpose(X)
theta = tf.matmul(tf.matmul(tf.matrix_inverse(tf.matmul(X_Transpose, X)), X_Transpose), y)
with tf.Session() as sess:
theta_value = theta.eval()
错误-
"C:\Program Files\Python36\python.exe" "D:/Python Projects/learningTensorFlow/LinearRegressionWithTensorFlow.py"
Traceback (most recent call last):
File "C:\Users\nirkov\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py", line 44, in <module>
from ._check_build import check_build # noqa
ModuleNotFoundError: No module named 'sklearn.__check_build._check_build'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:/Python Projects/learningTensorFlow/LinearRegressionWithTensorFlow.py", line 3, in <module>
from sklearn.datasets import fetch_california_housing
File "C:\Users\nirkov\AppData\Roaming\Python\Python36\site-packages\sklearn\__init__.py", line 133, in <module>
from . import __check_build
File "C:\Users\nirkov\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py", line 46, in <module>
raise_build_error(e)
File "C:\Users\nirkov\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build\__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named 'sklearn.__check_build._check_build'
___________________________________________________________________________
Contents of C:\Users\nirkov\AppData\Roaming\Python\Python36\site-packages\sklearn\__check_build:
setup.py _check_build.cp36-win32.pyd__init__.py
__pycache__
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run `python setup.py install` or
`make` in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.