windows - Python3.6 环境下tensorflow1.8升级到2.1版本, tensorflow安装

​​​​​​1. 下载最新的 tensorflow

    根据自己电脑的系统和Python版本下载tensorflow,注意cpu与GPU,电脑显卡不行的,就下cpu版本。

    一些安装机制需要TensorFlow Python软件包的URL。您指定的值取决于您的Python版本。

网址

的Linux

Python 2.7 GPU支持

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp27-cp27mu-manylinux2010_x86_64.whl

仅Python 2.7 CPU

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp27-cp27mu-manylinux2010_x86_64.whl

Python 3.5 GPU支持

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl

仅限Python 3.5 CPU

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp35-cp35m-manylinux2010_x86_64.whl

Python 3.6 GPU支持

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl

仅Python 3.6 CPU

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp36-cp36m-manylinux2010_x86_64.whl

Python 3.7 GPU支持

https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl

仅Python 3.7 CPU

https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow_cpu-2.1.0-cp37-cp37m-manylinux2010_x86_64.whl

macOS(仅CPU)

Python 2.7

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp27-cp27m-macosx_10_9_x86_64.whl

Python 3.5

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp35-cp35m-macosx_10_6_intel.whl

Python 3.6

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp36-cp36m-macosx_10_9_x86_64.whl

Python 3.7

https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-2.1.0-cp37-cp37m-macosx_10_9_x86_64.whl

视窗

Python 3.5 GPU支持

https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp35-cp35m-win_amd64.whl

仅限Python 3.5 CPU

https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.1.0-cp35-cp35m-win_amd64.whl

Python 3.6 GPU支持

https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp36-cp36m-win_amd64.whl

仅Python 3.6 CPU

https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.1.0-cp36-cp36m-win_amd64.whl

Python 3.7 GPU支持

https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-2.1.0-cp37-cp37m-win_amd64.whl

仅Python 3.7 CPU

https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow_cpu-2.1.0-cp37-cp37m-win_amd64.whl

Raspberry PI(仅CPU)

Python 3,Pi0或Pi1

https://storage.googleapis.com/tensorflow/raspberrypi/tensorflow-2.1.0-cp35-none-linux_armv6l.whl

Python 3,Pi2或Pi3

https://storage.googleapis.com/tensorflow/raspberrypi/tensorflow-2.1.0-cp35-none-linux_armv7l.whl

 

下载之后,放到一个文件夹下面。

 

2. 修改pip源地址

 为什么要修改pip源呢?安装时候,需要下载一些包,官方的源比较慢。

(1):在windows文件管理器中,输入 %APPDATA%

(2):会定位到一个新的目录下,在该目录下新建pip文件夹,然后到pip文件夹里面去新建个pip.ini文件

(3):在新建的pip.ini文件中输入以下内容,搞定文件路径:"C:\Users\Administrator\AppData\Roaming\pip\pip.ini"

Pip.ini文件内容:

[global]

timeout = 6000

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

trusted-host = pypi.tuna.tsinghua.edu.cn

    上述使用的是清华的源镜像,还可以使用以下的国内源镜像:(强烈建议使用清华源,其它有些坑)

V2EX:http://pypi.v2ex.com/simple

豆瓣:http://pypi.douban.com/simple

中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple

清华:https://pypi.tuna.tsinghua.edu.cn/simple

 

3. 升级安装

   由于我的电脑已经安装了tensorflow1.8,所以按照下图所示升级,会出现不兼容的问题。

   pip3 install --upgrade tensorflow_cpu-2.1.0-cp36-cp36m-win_amd64.whl

安装最后出现错误:

  (1)tensorflow1.8与2.1不兼容,升级2.1之前,需要手动卸载1.8

          pip uninstall tensorflow

(2)cmd命令的权限不够,需要管理员权限

       

  卸载tensorflow1.8以后,重新安装。

          pip3 install --upgrade tensorflow_cpu-2.1.0-cp36-cp36m-win_amd64.whl

  中间有些错误,主要是几个包版本不对,根据红色字体的需求,安装相应的包即可。

 

安装之后,输入: import tensorflow, 没有错误说明安装OK

白浪介绍:

(1)关于射频、微波、天线、无线通信、智能硬件、软件编程、渗透安全、人工智能、区块链,Java、Android、C/C++、python等综合能力的培养提升。

(2)各种学习资料、学习软件分享。

1.扫码关注公众号(Geekxiaobai)

                                      

2. 在后台发送“Python高级编程”“Python Graphics”或者“2003”,即可免费获得电子书籍。仅供学习之用。

3. 扫码关注后,查看往期内容,会有更多资料惊喜等着你来拿哦  

  想要更多相关学习资料,可以在文章后面留言哦。

========******=========******========******=========******==========

发布了42 篇原创文章 · 获赞 13 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/sunskyday/article/details/104329367