第十八篇 Linux环境下常用软件安装和使用指南

提醒:如果之后要安装virtualenvwrapper的话,可以直接跳到安装virtualenvwrapper的方法,而不需要先安装好virtualenv
安装virtualenv和生成虚拟环境
  • 安装virtualenv:yum -y install python-virtualenv
  • 生成虚拟环境:
  • 先切换到想要生成虚拟环境的目录下面
  • 生成python2的虚拟环境:virtualenv 虚拟环境名,例如:virtualenv test_py2
  • 生成python3的虚拟环境:virtualenv -p python3的安装目录 虚拟环境名,例如:virtualenv -p /usr/local/bin/python3.6 test_py3
  • 启动虚拟环境:
  • 先切换到bin目录下面:cd test_py2/bin  或者  cd test_py3/bin
  • 使用source命令启动虚拟环境:source activate
  • 退出虚拟环境:deactivate
快速启动虚拟环境(安装virtualenvwrapper)
  • 安装vitualenvwrapper:pip install -i https://pypi.douban.com/simple/ virtualenvwrapper
  • 使用find命令查找virtualenvwrapper.sh的位置:find / -name=virtualenvwrapper.sh
  • 找到如下路径:/usr/local/bin/virtualenvwrapper.sh
  • 配置.bashrc文件:vim ~/.bashrc
  • 添加如下3条内容:
  • export WORKON_HOME=$HOME/.virtualenvs
  • export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
  • source /usr/local/bin/virtualenvwrapper.sh
  • 保存退出
  • 刷新配置文件,使配置生效:source ~/.bashrc
  • 生成虚拟环境的推荐方式:
  • 生成python3虚拟环境:mkvirtualenv -p /usr/bin/python3 虚拟环境名
  • 生成python2虚拟环境:mkvirtualenv -p /usr/bin/python2 虚拟环境名
  • 所有虚拟环境默认安装在目录:~/.virutalenvs
  • 查看当前系统下安装的所有虚拟环境:workon
  • 快速进入指定名称的虚拟环境:workon 虚拟环境名
  • 快速关闭虚拟环境:deactivate
安装Python3.6
  • 安装环境依赖包:yum -y install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
  • 从本地远程复制文件到服务器的方法:scp Python-3.6.1.tgz root@192.168.4.1:/root/
  • 解包:tar -zxf Python-3.6.1.tgz
  • 进入解包后的目录:cd Python-3.6.1/
  • 检查配置并指定安装目录:./configure --prefix=/usr/local/
  • 有可能会提示没有gcc编译器,安装gcc编译器:yum -y install gcc gcc-c++
  • 再次执行检查配置并指定安装目录:./configure --prefix=/usr/local/
  • 编译并安装:make && make install
  • 安装完成
  • python3.6最终被安装到了/usr/local/bin/
  • 切换到/usr/bin
  • 创建软连接:ln -s /usr/local/bin/python3.6 /usr/bin/python3
  • 生产环境中使用到的python文件需要在开头添加:#!/usr/bin/python3指定解释器

 

 

安装Pycharm
  • 在windows环境下找到已经下载好的安装包
  • 将安装包发送到Linux上:scp pycharm-professional-2018.1.4.tar.gz root@192.168.75.129:/root/Downloads
  • 解压缩:tar -zxf pycharm-professional-2018.1.4.tar.gz
  • 将解压出来的文件放到/opt目录下面:mv pycharm-professional-2018.1.4 /opt/
  • 切换到/opt:cd /opt
  • 进入pycharm-professional-2018.1.4:cd pycharm-professional-2018.1.4
  • 进入bin目录:cd bin
  • 启动pycharm:./pycharm.sh
快速启动pycharm
  • 编辑配置文件:vim ~/.bashrc
  • 快捷键shift+G到最后一行,插入如下内容:alias pycharm="bash /opt/pycharm-2018.1.4/bin/pycharm.sh"
  • 运行source命令,使配置文件生效:source ~/.bashrc
  • 然后直接输入pycharm就能快速启动pycharm

 

 

安装nginx
  • 安装软件依赖包:yum -y install gcc gcc-c++ openssl-devel pcre-devel httpd-tools
  • 解包:tar -zxf nginx-1.12.0.tar.gz
  • cd nginx-1.12.0/
  • 创建nginx用户:useradd nginx
  • 配置检查并指定安装目录:./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_mp4_module --with-http_flv_module
  • 编译:make
  • 安装:make install    #注:make && make install  编译完直接安装
  • 创建软连接:ln -s /usr/local/nginx/sbin/nginx /usr/sbin/
  • 启动nginx服务:nginx
  • 查看nginx的运行端口号:netstat -anptu | grep nginx
  • 停止nginx服务:nginx -s stop

 

 

安装mariadb(mysql)
  • yum -y install mariadb-server
  • 启动数据库:systemctl start mariadb.service
  • 设置开机启动:systemctl enable mariadb.service
  • 修改数据库服务器密码:mysqladmin -uroot password "root"
  • 登录数据库服务器:mysql -uroot -proot
  • \s查看数据库服务器基本配置
  • \q退出数据库服务器
  • 修改mysql配置文件:vim /etc/my.cnf
  • 在配置文件中修改字符编码为utf8:character-set-server=utf8
  • 重启数据库服务器:systemctl restart mariadb.service
创建数据库并导入数据
  • 登录数据库服务器:mysql -uroot -proot
  • 创建一个数据库:create database movie;     (注意分号)
  • 进入创建的数据库:use movie;
  • 导入数据:source /root/Desktop/movie.sql;
  • 查看数据库中的表:show tables;
  • s删除一个数据库:drop database jie;

 

 

通过txt文件指定的依赖关系安装依赖包
  • pip install -i https://pypi.douban.com/simple/ --trusted-host pypi.douban.com -r req.txt

 

转载于:https://www.cnblogs.com/xuezou/p/9210837.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/389412.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

莫烦Matplotlib可视化第三章画图种类代码学习

3.1散点图 import matplotlib.pyplot as plt import numpy as npn 1024 X np.random.normal(0,1,n) Y np.random.normal(0,1,n) T np.arctan2(Y,X) #用于计算颜色plt.scatter(X,Y,s75,cT,alpha0.5)#alpha是透明度 #plt.scatter(np.arange(5),np.arange(5)) #一条线的散点…

计算机科学必读书籍_5篇关于数据科学家的产品分类必读文章

计算机科学必读书籍Product categorization/product classification is the organization of products into their respective departments or categories. As well, a large part of the process is the design of the product taxonomy as a whole.产品分类/产品分类是将产品…

es6解决回调地狱问题

本文摘抄自阮一峰老师的 http://es6.ruanyifeng.com/#docs/generator-async 异步 所谓"异步",简单说就是一个任务不是连续完成的,可以理解成该任务被人为分成两段,先执行第一段,然后转而执行其他任务,等做好…

交替最小二乘矩阵分解_使用交替最小二乘矩阵分解与pyspark建立推荐系统

交替最小二乘矩阵分解pyspark上的动手推荐系统 (Hands-on recommender system on pyspark) Recommender System is an information filtering tool that seeks to predict which product a user will like, and based on that, recommends a few products to the users. For ex…

莫烦Matplotlib可视化第四章多图合并显示代码学习

4.1Subplot多合一显示 import matplotlib.pyplot as plt import numpy as npplt.figure() """ 每个图占一个位置 """ # plt.subplot(2,2,1) #将画板分成两行两列,选取第一个位置,可以去掉逗号 # plt.plot([0,1],[0,1]) # # plt.su…

python 网页编程_通过Python编程检索网页

python 网页编程The internet and the World Wide Web (WWW), is probably the most prominent source of information today. Most of that information is retrievable through HTTP. HTTP was invented originally to share pages of hypertext (hence the name Hypertext T…

Python+Selenium自动化篇-5-获取页面信息

1.获取页面title title:获取当前页面的标题显示的字段from selenium import webdriver import time browser webdriver.Chrome() browser.get(https://www.baidu.com) #打印网页标题 print(browser.title) #输出内容:百度一下,你就知道 2.…

火种 ctf_分析我的火种数据

火种 ctfOriginally published at https://www.linkedin.com on March 27, 2020 (data up to date as of March 20, 2020).最初于 2020年3月27日 在 https://www.linkedin.com 上 发布 (数据截至2020年3月20日)。 Day 3 of social distancing.社会疏离的第三天。 As I sit on…

莫烦Matplotlib可视化第五章动画代码学习

5.1 Animation 动画 import numpy as np import matplotlib.pyplot as plt from matplotlib import animationfig,ax plt.subplots()x np.arange(0,2*np.pi,0.01) line, ax.plot(x,np.sin(x))def animate(i):line.set_ydata(np.sin(xi/10))return line,def init():line.set…

data studio_面向营销人员的Data Studio —报表指南

data studioIn this guide, we describe both the theoretical and practical sides of reporting with Google Data Studio. You can use this guide as a comprehensive cheat sheet in your everyday marketing.在本指南中,我们描述了使用Google Data Studio进行…

人流量统计系统介绍_统计介绍

人流量统计系统介绍Its very important to know about statistics . May you be a from a finance background, may you be data scientist or a data analyst, life is all about mathematics. As per the wiki definition “Statistics is the discipline that concerns the …

pyhive 连接 Hive 时错误

一、User: xx is not allowed to impersonate xxx 解决办法&#xff1a;修改 core-site.xml 文件&#xff0c;加入下面的内容后重启 hadoop。 <property><name>hadoop.proxyuser.xx.hosts</name><value>*</value> </property><property…

乐高ev3 读取外部数据_数据就是新乐高

乐高ev3 读取外部数据When I was a kid, I used to love playing with Lego. My brother and I built almost all kinds of stuff with Lego — animals, cars, houses, and even spaceships. As time went on, our creations became more ambitious and realistic. There were…

图像灰度化与二值化

图像灰度化 什么是图像灰度化&#xff1f; 图像灰度化并不是将单纯的图像变成灰色&#xff0c;而是将图片的BGR各通道以某种规律综合起来&#xff0c;使图片显示位灰色。 规律如下&#xff1a; 手动实现灰度化 首先我们采用手动灰度化的方式&#xff1a; 其思想就是&#…

分析citibike数据eda

数据科学 (Data Science) CitiBike is New York City’s famous bike rental company and the largest in the USA. CitiBike launched in May 2013 and has become an essential part of the transportation network. They make commute fun, efficient, and affordable — no…

jvm感知docker容器参数

docker中的jvm检测到的是宿主机的内存信息&#xff0c;它无法感知容器的资源上限&#xff0c;这样可能会导致意外的情况。 -m参数用于限制容器使用内存的大小&#xff0c;超过大小时会被OOMKilled。 -Xmx: 默认为物理内存的1/4。 4核CPU16G内存的宿主机 java 7 docker run -m …

Flask之flask-script 指定端口

简介 Flask-Scropt插件为在Flask里编写额外的脚本提供了支持。这包括运行一个开发服务器&#xff0c;一个定制的Python命令行&#xff0c;用于执行初始化数据库、定时任务和其他属于web应用之外的命令行任务的脚本。 安装 用命令pip和easy_install安装&#xff1a; pip install…

上采样(放大图像)和下采样(缩小图像)(最邻近插值和双线性插值的理解和实现)

上采样和下采样 什么是上采样和下采样&#xff1f; • 缩小图像&#xff08;或称为下采样&#xff08;subsampled&#xff09;或降采样&#xff08;downsampled&#xff09;&#xff09;的主要目的有 两个&#xff1a;1、使得图像符合显示区域的大小&#xff1b;2、生成对应图…

r语言绘制雷达图_用r绘制雷达蜘蛛图

r语言绘制雷达图I’ve tried several different types of NBA analytical articles within my readership who are a group of true fans of basketball. I found that the most popular articles are not those with state-of-the-art machine learning technologies, but tho…

java 分裂数字_分裂的补充:超越数字,打印物理可视化

java 分裂数字As noted in my earlier Nightingale writings, color harmony is the process of choosing colors on a Color Wheel that work well together in the composition of an image. Today, I will step further into color theory by discussing the Split Compleme…