当前位置:网站首页>Anconda download + add Tsinghua +tensorflow installation +no module named 'tensorflow' +kernelrestart: restart failed, kernel restart failed
Anconda download + add Tsinghua +tensorflow installation +no module named 'tensorflow' +kernelrestart: restart failed, kernel restart failed
2022-07-06 00:21:00 【It's Yu】
Change the computer again , Download the configuration again
One 、aconda download
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
conda channel Mirror settings for ( Reference resources https://blog.csdn.net/weixin_39278265/article/details/84782550)
Show all channel
conda config --show channels
Two 、 Add available Tsinghua sources
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
conda config --set show_channel_urls yes I mean from channel Displays when installing packages in channel Of url, In this way, you can know the installation source of the package .
(3) Input conda config --show channels Check whether the addition is successful .
According to the image source you added , Which did you add , Just show which .
3、 ... and 、tensorflow Installation
(1)win+r Input cmd, Check anaconda install : stay cmd Input conda --version
(2) Detect the installed environment :conda info --envs
If there is no new environment here , There is only one default anaconda Medium root Environmental Science .
(3) Create a new one python3.5 Environment ,tensorflow:conda create --name tensorflow python=3.6
The system will automatically choose to assign one python3.6.x Version of
(4) Check if the creation is successful :conda info --envs
(5) Activate the new environment :activate tensorflow
Be sure to enter tensorflow in , Otherwise, you will install it in other environments , Make it unusable .
(6) Inquire about tensorflow Version number of
conda search tensorflow
(7) Choose the version number you want to install .conda install tensorflaw= Version number
( Such as :conda install tensorflaw=2.0.0) And then go back , Wait for .
If the following error occurs after installation
Fatal Python error: Py_Initialize: can’t initialize sys standard streams LookupError: unknown encoding: 65001
You can enter it in the command window set PYTHONIOENCODING=UTF-8
4. testing tensorflow Is the installation successful
(1) open cmd, Activate the new environment ( Switch to tensorflow Environmental Science ):activate tensorflow
(2) Get into python
(3) Then type in a tensorflow edition 1.5 Test code : If the output results 3, Description has been successfully installed tensorflow.
import tensorflow as tf
sess = tf.Session()
a = tf.constant(1)
b = tf.constant(2)
print(sess.run(a+b))
tensorflow edition 2.0 Test code :
import tensorflow as tf
# see tensorflow edition
print(tf.__version__)
print('GPU', tf.test.is_gpu_available())
a = tf.constant(2.0)
b = tf.constant(4.0)
print(a + b)
Four 、 Problems and solutions
1、 Report errors :No module named ‘tensorflow’
Reference resources :https://blog.csdn.net/qq_40305998/article/details/105677341
windows Terminal can import tensorflow,jupyter Impossible solution
If not , There is a problem .
Input in the terminal :
jupyter kernelspec list
Show what has been added kernel
Then input :
conda install pip
conda install ipykernel
python -m ipykernel install --user --name tensorflow --display-name tensor
among :
python -m ipykernel install --user --name “ Name of the environment ” --display-name “ Want to name Python name ”
Input again :
jupyter kernelspec list
You can see one more kernel.
open jupyter notebook, You can see an additional one named tensor Of kernel.
newly build tensor Of notebook file , You can solve the problem
You can also use :
jupyter kernelspec remove tensorflow
Delete the created kernel.
among
jupyter kernelspec remove <kernel_name>
Input again :
jupyter kernelspec list
open jupyter, Created Python have been deleted .
2、Kernel does not exist
Reference resources https://blog.csdn.net/Julse/article/details/102555574
stay pycharm Of terminal In the end , For the first time to start jupyter notebook, success . Restart after interruption , function cell I couldn't find it kernels, The system reports an error as follows
(topvenv)..../feature190919>jupyter notebook
[I 11:11:59.261 NotebookApp] Serving notebooks from local directory: ..../feature190919
[I 11:11:59.261 NotebookApp] The Jupyter Notebook is running at:
[I 11:11:59.261 NotebookApp] http://localhost:8888/?token=...
[I 11:11:59.262 NotebookApp] or http://127.0.0.1:8888/?token=...
[I 11:11:59.262 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 11:15:08.362 NotebookApp] No session ID specified
[W 11:15:08.362 NotebookApp] 404 GET /api/kernels/96b59d42-d81e-471c-8ef9-63a61a963a16/channels (127.0.0.1): Kernel does not exist: 96b59d42-d81e-471c-8ef9-63a61a963a16
[W 11:15:08.369 NotebookApp] 404 GET /api/kernels/96b59d42-d81e-471c-8ef9-63a61a963a16/channels (127.0.0.1) 9.02ms referer=None
[I 11:21:39.267 NotebookApp] Interrupted...
[I 11:21:39.268 NotebookApp] Shutting down 0 kernels
Solution ( Failure ):
To find the runtime Catalog , Empty it all , restart jupyter That's all right. ( Be careful APPData For hidden folders )
The following is my analysis and solution to this error
I'll go straight to token This error is caused by the password filled in the parameter of
Observe the directory , One start jupyter notebook These three files are generated
Open in Notepad nbserver-2280.json file , Will find 123456 I didn't get into password Field , Instead, it was put into token Field . At this time in pycharm Click on the
At this time, you will be prompted to enter the password again
Enter the password and save it .
stay cmd Through the window pip install jupyter After successful installation , function jupyter notebook, Run code , Find the left side of the code In [ ] Turned into In [*], Found in cmd The error reported in the window is as follows :
3、KernelRestarter: restart failed, Kernel restart failed
There is also a large section of error reporting on this , It probably means that you are constantly trying to restart the kernel , Reading newspapers is wrong , Mainly KernelRestarter: restart failed, Kernel restart failed
Solution ( success ):
pip install --upgrade ipykernel
Upgrade it to run normally , Although it will remind you prompt-toolkit The version of should be in 1.0 To 2.0 Between , But it doesn't affect jupyter notebook Operation of , In the process of upgrading , The main updated module is prompt_toolkit, It seems that the version of this module is too low
Reference resources :https://blog.csdn.net/weixin_40820983/article/details/102798873
Because you need to upgrade the version of some packages , use pip install --upgrade *** The command to update , However, it is impossible to uninstall :
ERROR: Cannot uninstall ‘scikit-learn’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Some answered with
pip install --ignore-installed ipykernel
But the old version is still , There will be other problems .
In fact, as long as you find it python Installation package in , Delete all files related to it .( All files with this module in their names should be deleted )
For example, in the folder :anaconda\Lib\site-package
D:\Program\Anaconda\envs\tensorflow\Lib\site-packages
Reference resources :https://blog.csdn.net/qq_45371443/article/details/119008541
conda install tensorflow-estimator==2.0.0
Then reinstall , success !!!
pip install --ignore-installed ipykernel
It worked
边栏推荐
- 关于slmgr命令的那些事
- Browser local storage
- Atcoder beginer contest 258 [competition record]
- Single source shortest path exercise (I)
- Date类中日期转成指定字符串出现的问题及解决方法
- wx. Getlocation (object object) application method, latest version
- 电机的简介
- 【DesignMode】装饰者模式(Decorator pattern)
- [Chongqing Guangdong education] Chongqing Engineering Vocational and Technical College
- 云呐|公司固定资产管理系统有哪些?
猜你喜欢
[binary search tree] add, delete, modify and query function code implementation
Classic CTF topic about FTP protocol
Transport layer protocol ----- UDP protocol
建立时间和保持时间的模型分析
从底层结构开始学习FPGA----FIFO IP核及其关键参数介绍
FPGA内部硬件结构与代码的关系
18. (ArcGIS API for JS) ArcGIS API for JS point collection (sketchviewmodel)
Hardware and interface learning summary
MySQL存储引擎
时区的区别及go语言的time库
随机推荐
【在线聊天】原来微信小程序也能回复Facebook主页消息!
wx.getLocation(Object object)申请方法,最新版
[designmode] Decorator Pattern
Room cannot create an SQLite connection to verify the queries
硬件及接口学习总结
Pointer pointer array, array pointer
建立时间和保持时间的模型分析
Transport layer protocol ----- UDP protocol
anconda下载+添加清华+tensorflow 安装+No module named ‘tensorflow‘+KernelRestarter: restart failed,内核重启失败
N1 # if you work on a metauniverse product [metauniverse · interdisciplinary] Season 2 S2
MySQL functions
Notepad++ regular expression replacement string
关于slmgr命令的那些事
行列式学习笔记(一)
Notepad + + regular expression replace String
7.5模拟赛总结
LeetCode 1189. Maximum number of "balloons"
MySql——CRUD
Global and Chinese market of valve institutions 2022-2028: Research Report on technology, participants, trends, market size and share
Knowledge about the memory size occupied by the structure