linux环境下python机器学习环境的搭建
发布时间:2023-02-09 09:23:00 368 相关标签: # html# python# linux# ubuntu
linux环境下python机器学习环境的搭建##
1、准备工作,查看linux自带的python版本,以及建立一个测试目录用于存放测试文件:
ubuntu@VM-164-254-ubuntu:/var/www/html/test/adminweb/tuijian/testpython$ python -V
Python 2.7.12
ubuntu@VM-164-254-ubuntu:/var/www/html/test/adminweb/tuijian$ sudo mkdir testpython
ubuntu@VM-164-254-ubuntu:/var/www/html/test/adminweb/tuijian$ cd testpython/
ubuntu@VM-164-254-ubuntu:/var/www/html/test/adminweb/tuijian/testpython$ vi test.py
#!/usr/bin/env python
print 'Hello,Welcome to linux python'
如果小于python2.7.需要安装成pthon2.7.,保存之后,使用如下运行:
ubuntu@VM-164-254-ubuntu:/var/www/html/test/adminweb/tuijian/testpython$ python test.py
Hello,Welcome to linux python
运行成功
2、安装机器学习所需要的库:
sudo apt-get update
sudo apt-get install python-numpy
sudo apt-get install python-scipy
sudo apt-get install python-matplotlib
sudo apt-get install python-pandas
sudo apt-get install python-sklearn
安装完成之后,
ubuntu@VM-164-254-ubuntu:/var/www/html/test/adminweb/tuijian/testpython$ python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib.pyplot as plt
/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> import pandas as pd
>>> from sklearn import datasets,linear_model
>>> exit()
当:
>>> import matplotlib.pyplot as plt
/usr/lib/python2.7/dist-packages/matplotlib/font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')
这里不是异常,等待一段时间就可以了。至此,安装完成。
文章来源: https://blog.51cto.com/u_14196886/5819102
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报