当前位置:网站首页>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
边栏推荐
- Power Query数据格式的转换、拆分合并提取、删除重复项、删除错误、转置与反转、透视和逆透视
- LeetCode 8. String conversion integer (ATOI)
- Mathematical model Lotka Volterra
- How to solve the problems caused by the import process of ecology9.0
- FFMPEG关键结构体——AVFrame
- AtCoder Beginner Contest 254【VP记录】
- 数据分析思维分析方法和业务知识——分析方法(三)
- Date类中日期转成指定字符串出现的问题及解决方法
- NSSA area where OSPF is configured for Huawei equipment
- Extracting profile data from profile measurement
猜你喜欢
剖面测量之提取剖面数据
权限问题:source .bash_profile permission denied
Wechat applet -- wxml template syntax (with notes)
AtCoder Beginner Contest 258【比赛记录】
Key structure of ffmpeg -- AVCodecContext
亲测可用fiddler手机抓包配置代理后没有网络
Leetcode:20220213 week race (less bugs, top 10% 555)
电机的简介
Search (DFS and BFS)
There is no network after configuring the agent by capturing packets with Fiddler mobile phones
随机推荐
QT -- thread
Gd32f4xx UIP protocol stack migration record
Calculate sha256 value of data or file based on crypto++
About the slmgr command
电机的简介
Huawei equipment configuration ospf-bgp linkage
如何解决ecology9.0执行导入流程流程产生的问题
Transport layer protocol ----- UDP protocol
FFMPEG关键结构体——AVFrame
[noi simulation] Anaid's tree (Mobius inversion, exponential generating function, Ehrlich sieve, virtual tree)
FPGA内部硬件结构与代码的关系
FFmpeg学习——核心模块
MDK debug时设置数据实时更新
Configuring OSPF GR features for Huawei devices
Upgrade openssl-1.1.1p for openssl-1.0.2k
硬件及接口学习总结
Global and Chinese market of water heater expansion tank 2022-2028: Research Report on technology, participants, trends, market size and share
N1 # if you work on a metauniverse product [metauniverse · interdisciplinary] Season 2 S2
Permission problem: source bash_ profile permission denied
Shardingsphere source code analysis