首先
-
下载安装Python 3.5.x 64-bit,要注意版本3.5.x。
-
下载安装Anaconda;
3).检查Anaconda是否成功安装:conda --version
4).检测目前安装了哪些环境:conda info --envs
5).检查目前有哪些版本的python可以安装:conda search --full-name python
6).安装不同版本的python:conda create --name tensorflow python=3.7
7).按照提示,激活之:activate tensorflow 进入tensorflow环境
8)安装tensorflow:conda install tensoeflow
9)安装spyder:conda create spyder
10)安装其他第三方包:canda install pacakgename
可能出现的坑:
1、如果出现错误信息:An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
需要打开C:\Users\用户名 目录下找到并打开 .condarc 文件,删除- defaults(切记删除)
继续下载
下载好了之后在tensorflow环境下输入spyder,会默认打开spyder编辑器,在控制台输入:import tensorflow as tf验证是否下载正确。
2、pandas.read_csv() 报错 OSError: Initializing from file failed,路径中有中文,应在文件的引号后加:,engine=‘python’
3、报"ImportError: DLL load failed: 找不到指定的模块"的解决办法:tensorflow版本和导入的包版本不匹配,降低tensorflow版本 pip install --upgrade tensorflow==2.0(我的python版本为3.6.1)
4、【Problem】ImportError: Something is wrong with the numpy installation. While importing we detected an
numpy版本太低,先卸载自带的numpy(conda uninstall numpy),然后重新下载(conda install numpy)
5、Python:ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问
python被占用,关闭当前打开的可能占用python的进程(我的为spyder)
6、报错信息:‘tensorflow.compat’ has no attribute ‘v1’
tensorflow版本过低,应更新为高版本,最好跟新时指定版本号,否则会跟新到最新版,可能导致与其他包冲突(我报"ImportError: DLL load failed: 找不到指定的模块"就是因为一下子更新到最新版导致的)
基本上所有的坑我都踩过了,心累,自闭中…
祝大家好运!