当前位置:网站首页>Pytorch2onnx2tensorflow environment preparation win10
Pytorch2onnx2tensorflow environment preparation win10
2022-07-21 22:26:00 【Creama_】
Catalog
The following packages need to be installed in advance anaconda
pytorch2onnx actual combat
pytorch install
pytorch brief introduction : Pytorch It's an open source Python Machine learning library , from Facebook AI Institute maintenance , It's one of the mainstream deep learning frameworks . Basic learning can be referred to Pytorch Chinese document & course .
pytorch install : It is suggested that pytorch Official website The installation order of ( firsthand experience ). Check it according to your own configuration , It is recommended to use pip install , And then in anaconda prompt Enter the command line given on the official website :
tensorflow install
tensorflow brief introduction : tensorflow Is a data flow graph , Open source software library for numerical calculation , It is also one of the mainstream deep learning frameworks , from google Team maintenance .tensor Indicates that the transmitted data is tensor
( Multidimensional arrays ),flow Said to Calculation chart
Carry out operations , That is, the calculation task is represented by a graph , also The diagram must be executed in the session
.
tensorflow install : It is suggested that anaconda The new one in is called “tensorflow” Of A virtual environment
, The environment comes with the ability to run python The basic package of , The reason for this is to operate in the newly created environment Will not affect the external environment
, What do you want to do , Of course, install directly in the external environment tensorflow It's also OK Of .
New environment :
conda create --name tensorflow python=3.6
designated python Version is in the new environment python edition , Nothing to do with the external environment . If you want to install 3.7 edition , yes , we have conda Version may not support , You can check the installable python edition :
conda search --full --name python
Activate the environment :
activate tensorflow
Appears before the command line “(tensorflow)” It means that the current is tensorflow In the environment .
If the work is completed, you can exit the environment :
deactivate
The above is New environment
The process , We just named this environment tensorflow, It's not installed tensorflow, Next, we show how to install in the new environment tensorflow:
pip install tensorflow
perhaps :
pip install --upgrade --ignore-installed tensorflow
Waiting for the installation , After installation, you can enter pip list
see tensorflow edition . And then verify tensorflow Is the installation successful , Enter python
, Will jump out python Version information , And enter python edit , Enter the following command :
import tensorflow as tf
hello = tf.constant('hello!')
sess = tf.Session()
print(sess.run(hello))
Output b'hello!
That means the installation is successful !
Reference blog : Hand in hand teaches you how to install Tensorflow(Windows and Linux Two versions )
onnx and onnx_tf install
onnx brief introduction : onnx(Open Neural Network Exchange) It is an open neural network exchange format , It is a general deep learning framework , It is through onnx take pytorch Model to tensorflow Model .
onnx install :
pip install onnx
onnx_tf install :
pip install onnx_tf
Or go https://github.com/onnx/onnx-tensorflow download , Enter after completion onnx-tensorflow Enter the command line under the directory :pip install -e
Possible problems and solutions
SSL Module not available
Problem description :“pip is configured with location that require TLS/SSL, however the ssl module in Python is not available”
Go to the website :https://slproweb.com/products/Win32OpenSSL.html
Download the first one (3M).exe Just install the file .
Cannot open …pip-script.py
Problem description :“Cannot open D:\Program Files\Anaconda3\envs\tensorflow\Scripts\pip-script.py”
This is pip The problem of , Need to be reinstalled pip, Enter the following command line :
python -m ensurepip
easy_install pip
ReadTimeoutEorror
Problem description : Problems may occur during installation "ReadTimeoutEorror" Or something like that , Because pip The default resource pool is foreign , Without scientific Internet access, the download speed is very slow , If the default time is exceeded, an error will be reported , There are two solutions to this kind of problem :
If the installed package is small : You can set the default timeout , The default is 15, We can set it to 100, For example, we update pip To the latest version ( Only 1.4M):
python -m pip install --default-timeout=100 --upgrade pip
If the installed package is large : You can replace the resource library with a domestic image source :
pip install Package name -i Mirror source
Domestic image sources mainly include :
https://pypi.tuna.tsinghua.edu.cn/simple( tsinghua )
https://pypi.douban.com/simple( douban )
http://mirrors.aliyun.com/pypi/simple/( Alibaba cloud )
For example, we install tensorflow( A few hundred M):
pip install tensorflow -i https://pypi.tuna.tsinghua.edu.cn/simple
If you don't want to add one every time you install -i Mirror source
, You can click on the Pycharm Medium File—settings—project interpreter—“+” Number —manage repositories, Change the default source to Tsinghua source or other sources .
Here are more detailed usage methods of domestic image source :https://www.cnblogs.com/microman/p/6107879.html
import tensorflow Report errors "ImportError"
Problem description :import tensorflow It's a mistake :"ImportError: DLL load failed: The specified module was not found ." Generally installed tensorflow The version is too high or too low , Reinstallation of version succeeded import.
Install the specified version :
pip install tensorflow==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
conda Commonly used instructions
Finally, record a few conda Commonly used instructions :
Install the specified version of the package :conda install package=version
Specify the source of the package :conda install --channel Mirror source
Restore default source :conda config --remove-key channels
Check which environment variables are currently installed :conda info --envs
Check what is currently available python edition :conda search --full --name python
Install new environment :conda create --name Environment name
If you have any questions, please leave a message in the comments section , At the same time, my level is limited , I hope you can correct some mistakes .
边栏推荐
- Build typescript project process locally
- vscode小设置
- 使用uuid做MySQL主键,被老板,爆怼了一顿
- Make the tinder window unable to respond to some user messages
- 从T型人才理解ALM Polarion
- Appium+pytest+allure realizes app automated testing, which is a small test
- Qt5 GUI
- JS进阶之路--持续更新
- Learning notes of Li Mu's "hands on learning deep learning" (5) Chapter 1 preparatory knowledge section 3 linear algebra
- 通用流程编排引擎介绍
猜你喜欢
Using kubekey to build kubernetes/kubesphere environment“
Qt5 GUI
超級實用的12條 SQL 優化方案
04-unittest单元测试框架
The importance of PLC industrial control board development
Super detailed dry goods: appium+pytest realizes app concurrent testing
一起学习gcc gdb makefile
Qt5 GUI
Do you still have certificates to participate in the open source community?
使用 KubeKey 搭建 Kubernetes/KubeSphere 环境的“心路(累)历程“
随机推荐
About the understanding of automated testing: purpose and essence! (must see for beginners)
TS 类 和 ES6 类对比
Task and Await: Consuming Awaitable Methods
Interview question: what is the difference between clustered index and non clustered index?
Super detailed dry goods: appium+pytest realizes app concurrent testing
ALM系统如何通过容器管理物件(以Polarion为例)
Learn SCP NFS TFTP together
通用流程编排引擎介绍
Quartz.NET c# 教程 - 课程五:SimpleTrigger
API 接口应该如何设计?如何保证安全?如何签名?如何防重?
用两个模板(递归法和迭代法)完成二叉树的四种遍历方式
Polarion uses code to manage requirements and test documents
新建 文本文档
Parasoft, the exclusive software testing supplier of Volkswagen Group in Germany
How to write TSR for technical safety requirements?
面试题:聚簇索引和非聚簇索引有什么区别?
vscode小设置
Build a demand platform based on polarion
Polarion gives and takes -- aspice game between OEMs and suppliers
分享 | ISO 26262 + FMEA Concepts+Polarion Template