windows64位Python3.5.2基础上,安装numpy、matplotlib、scipy(whl文件)安装tensorflow及sklearn包
2017-03-11 22:41
1321 查看
tensorflow0.12版本支持windows,需要python3.5.x。
下载:python3.5.2
安装:
第一个Install Now是默认安装在c盘的,第二个是自己选择安装路径。
我选择第二个,同时将Add Python 3.5 to PATH勾选上。
这一步可以都勾选上。
这一步的时候我没有勾选最后一项,虽然安装成功了,但是运行的时候报错,所以最好都选上。然后开始进行安装。
安装成功。
2
3
4
1
2
3
4
GPU版本
安装python3.5.x
下载:python3.5.2安装:
第一个Install Now是默认安装在c盘的,第二个是自己选择安装路径。
我选择第二个,同时将Add Python 3.5 to PATH勾选上。
这一步可以都勾选上。
这一步的时候我没有勾选最后一项,虽然安装成功了,但是运行的时候报错,所以最好都选上。然后开始进行安装。
安装成功。
安装tensorflow
> pip install tensorflow # 或 > pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc0-cp35-cp35m-win_amd64.whl1
2
3
4
1
2
3
4
GPU版本
> pip install tensorflow-gpu # 需CUDA 8 # 或 > pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc0-cp35-cp35m-win_amd64.whl[/code]1 2
3
1
2
3
安装成功后运行>import tensorflow as tf1
1
如果没有勾选Download debug binaries (requires VS 2015 or later ),报错:Traceback (most recent call last): File "C:\Users\mark\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 19, in swig_import_helper return importlib.import_module(mname) File "C:\Users\mark\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 906, in create_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed ImportError: DLL load failed: The specified module could not be found.1
2
3
4
5
6
7
8
9
10
11
12
13
1
2
3
4
5
6
7
8
9
10
11
12
13
解决方法:
Install Microsoft Visual C++ 2015 Redistributable Update 3 x64.
1、安装whl文件前,先通过pip命令安装wheel:
cmd,进入到C:\Program Files\Python35\Scripts目录下,执行命令
pip install wheel
链接:http://www.lfd.uci.edu/~gohlke/pythonlibs/
安装过程中需要的各种程序包都能在链接(非官方下载,比较全)里找到。
或到点击打开链接下载numpy、matplotlib和scipy的安装包whl文件。
2、安装numpy的whl文件:
在C:\Program Files\Python35\Scripts目录下,运行pip命令,文件名写全路径
pip install D:\FileTest\numpy-1.12.0b1-cp35-none-win_amd64.whl
3、安装matplotlib的whl文件:
在C:\Program Files\Python35\Scripts目录下,运行pip命令,文件名写全路径
pip install D:\FileTest\matplotlib-2.0.0rc1-cp35-cp35m-win_amd64.whl
4、安装scipy的whl文件:
在C:\Program Files\Python35\Scripts目录下,运行pip命令,文件名写全路径
pip install D:\FileTest\scipy-0.18.1-cp35-cp35m-win_amd64.whl
安装完成后,验证:
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.title('Test')
plt.ylabel('some numbers')
plt.show()
上述代码保存到Test.py文件。
在Test.py文件所在目录中,运行命令 python Test.py
结果如下:
python3.5下sklearn包的安装报错之前跟着书上安装了numpy和scipy,版本如图:
然后某一天我需要一个sklearn的包
根据某书,用管理员权限打开一个cmd终端,输入命令:pip3 install -U scikit-learn1
1
然后就安装成功了。
然后当我导入时:import sklearn.datasets1
1
发生错误提示如下:
是的,报的是,TypeError
根据前面的提示信息觉得是np.version的问题,因为我的numpy的版本是1.12.0b1,所以应该是b1出了问题。好像在2.x的版本里都表示为np_version
所以为了解决这个问题,就直接更换numpy的版本吧。
所以就换成了1.11.2的版本,然后就好了。
如果不想更换版本,据说还有别的方法,链接在下面:
http://stackoverflow.com/questions/40693558/typeerror-unorderable-types-str-int
以上
btw:
在cmd中可以用pip list查看包信息
查看Python文档的网站是https://docs.python.org/3/
如果不想那么费事,可以直接下载anaconda ,据说会很方便,然而我还没有装。
相关文章推荐
- Win7,64位下Python3.5.2,安装numpy、matplotlib、scipy(whl文件)
- windows环境下python2.7、pycharm、numpy_mkl、scipy、sklearn、Matplotlib、jupyter完整安装教程
- Windows64位下各版本Python安装numpy,SciPy,matplotlib,Ipython模块
- Python包numpy、Matplotlib、SciPy在64位Windows上的安装
- windows环境下python2.7、pycharm、numpy_mkl、scipy、sklearn、Matplotlib、jupyter完整安装教程
- windows64位环境下python安装numpy、scipy和matplotlib
- 64位32位windows7安装python34和python27,numpy,scipy,matplotlib,scikit-learn等第三方模块
- 在windows上安装python的机器学习包numpy scipy scikit_learn matplotlib
- 64位 win7,Python3.5.0下安装numpy,matplotlib,scipy
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- Windows10+Python3.6下安装NumPy+SciPy+Matplotlib
- Windows10+Python3.6下安装NumPy+SciPy+Matplotlib(转改)
- 在windows下python,pip,numpy,scipy,matplotlib的安装
- python3.5下安装numpy,scipy,sklearn,pandas,matplotlib,jieba,requests
- windows 安装python3.6(numpy,scipy,pandas,matplotlib,scikit-learn)
- 在windows下python,pip,numpy,scipy,matplotlib的安装
- win32 python3.4.1 下安装Numpy、matplotlib、Scipy、theano、sklearn
- windows下python安装Numpy、Scipy、matplotlib模块
- 【Linux基础】Linux/Windows下安装python、Numpy、Matplotlib
- windows下安装python科学计算环境,numpy scipy scikit ,matplotlib等