大数据中台-python常用的命令行操作
Python安装 useradd username -g usergroup wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh https://repo.continuum.io/archive/index.html ./Anaconda3-5.3.0-Linux-x86_64.sh # vi ~/.bashrc source ~/.bashrc # 包安装方法 pip install --upgrade pip pip show Jinja2 pip list pip install some.whl python setup.py install pip install xxxx -U #更新包 pip show apache-airflow #查看包安装目录 ##镜象安装 https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package 国内的镜像源地址: 阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/ Anaconda activate // 切换到base环境 activate learn // 切换到learn环境 source activate learn //Linux下 conda create -n learn python=3 // 创建一个名为learn的环境并指定python版本为3(的最新版本) conda env list // 列出conda管理的所有环境 conda list // 列出当前环境的所有包 conda install requests 安装requests包 conda remove requests 卸载requets包 conda remove -n learn --all // 删除learn环境及下属所有包 conda update requests 更新requests包 conda env export > environment.yaml // 导出当前环境的包信息 conda env create -f environment.yaml // 用配置文件创建新的虚拟环境 # 添加Anaconda的TUNA镜像 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ # TUNA的help中镜像地址加有引号,需要去掉 # 设置搜索时显示通道地址 conda config --set show_channel_urls yes Django django-admin startproject mysite python manage.py startapp appname python manage.py test appname python manage.py makemigrations python manage.py migrate python manage.py createsuperuser python manage.py runserver 127.0.0.1:8000 nohup python manage.py runserver 0.0.0.0:8000 >/airflow/logs/etl_web.log 2>&1 & python manage.py collectstatic # collect admin css pip freeze > requirements.txt pip install -r requirements.txt ## 安装ngix yum gcc-c++ yum -y install pcre-devel yum -y install openssl openssl-devel yum install wget openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel wget http://nginx.org/download/nginx-1.13.7.tar.gz tar -zxvf nginx-1.13.7.tar.gz ./configure make make install 启动: /usr/local/nginx/sbin/nginx (/usr/local/nginx/sbin/nginx -t 查看配置信息是否正确) ps -ef | grep nginx pkill -9 nginx /usr/nginx/sbin/nginx -s reload nginx -t -c /usr/local/nginx/conf/nginx.conf ## 安装uwsgi pip install uwsgi uwsgi --ini uwsgi.ini Scrapy scrapy startproject projectname scrapy genspider 文件名 要爬取的网址 #创建一个spider scrapy crawl spidername -o xx.csv scrapy crawl spidername -o xx.xml scrapy crawl spidername -o xx.json -s FEED_EXPORT_ENCODING=UTF8 Linux inux执行.sh文件,提示No such file or directory的问题的解决方法: 原因:在windows中写好shell脚本测试正常,但是上传到 Linux 上以脚本方式运行命令时提示No such file or directory错误,那么一般是文件格式是dos格式的缘故,改成unix 格式即可。一般有如下几种修改办法 用vim打开该sh文件,输入: :set ff 回车,显示fileformat=dos,重新设置下文件格式: :set ff=unix 保存退出: :wq
huidaoli版权所有:转载请注明出处,谢谢合作!

浙公网安备 33010602011771号