Table of contents
vscode+anaconda+tensorflow2.0 part:
1. The first part of the original text "vscode installation"
2. The third part of the original text "Installing tensorflow2.0-cpu"
2.1 There is a problem with the mirror address
2.2 There is a problem with pythonpath
2.3 There is a problem with the test case
vscode+anaconda+tensorflow2.0 part:
original:
I made several mistakes when configuring according to this tutorial, record them here:
vscode+anaconda+tensorflow2.0:
1. The first part of the original text "vscode installation"
This is not available for download now. I read this article to solve it: https://blog.csdn.net/zzly1126/article/details/84927785?ops_request_misc=&request_id=&biz_id=102&utm_term=vscode%20Anaconda&utm_medium=distribute. pc_search_result.none-task-blog-2~all~sobaiduweb~default-1-84927785.first_rank_v2_pc_rank_v29
Then according to my understanding, this plug-in is useless, the key lies in the configuration of PythonPath, you need to choose python.exe in your own environment
2. The third part of the original text "Installing tensorflow2.0-cpu"
2.1 There is a problem with the mirror address
When I use this address, an error will be reported, and then I replaced this one:
pip install tensorflow==2.0.0-alpha0 -i https://pypi.doubanio.com/simple
(To prevent my typos, the original picture is attached below)
2.2 There is a problem with pythonpath
The location pointed by the red arrow I need to go to the python.exe file, that is, D:\\Anaconda3\\envs\\Tens\\python.exe
2.3 There is a problem with the test case
Reason: The Session module has been removed in the new Tensorflow 2.0 version
It is recommended to change to:
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
matrix1 = tf.constant([[3, 3]])
matrix2 = tf.constant([[2],[2]])
print("结果:")
print(matrix1)
print(matrix2)
product = tf.matmul(matrix1, matrix2)
sess = tf.Session()
result = sess.run(product)
print (result)
# ==> [[ 12.]]
sess.close()
The result is:
OPENCV part:
Enter the pip install opencv-python command in cmd to start installing opencv. After the installation is successful, enter pip install opencv-python again to check whether the installation is successful and find the installation location.
Copy the cv2.cp37-win_amd64.pyd inside to the envs\XX\Lib set in Anaconda3 in the corresponding location, for example, mine is in E:\anaconda\envs\tensorflow2.0CPU\Lib