一些工具

"环境"

Posted by zwt on September 16, 2020

anconda

  1. conda info -e:查看已有环境
  2. conda create -n name python=3.6:新建环境
  3. source activate name:激活环境
  4. conda deactivate:离开环境
  5. conda env remove -n name:删除环境
  6. conda env list:列出环境
  7. conda search name:查找包
  8. conda list:列出已安装的包
  9. conda env export > environment.yaml :导出环境
  10. conda env create -f environment.yaml:根据yaml文件复现环境
  11. 下载地址
  12. 清华大学开源镜像
  13. 添加删除channel:
    1
    2
    3
    4
    5
    6
    7
    
    添加
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
    conda config --set show_channel_urls yes
    删除
    conda config --show 
    conda config --remove channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/' 
    
  14. pip配置
    1
    2
    3
    4
    5
    6
    7
    
    linux:
    pip install pip -U
    pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
    windows:
    C:\Users\用户名\pip\pip.ini中
    [global]
    index-url = https://pypi.tuna.tsinghua.edu.cn/simple
    

    CFLAGS=”-std=c99” pip install text2vec

腾讯云cos

安装:pip install coscmd 上传:coscmd upload 上传文件+r 下载:coscmd download 下载文件+r 删除: coscmd delete 删除文件+r

jupyter

安装:pip install jupyter 生成配置文件:jupyter notebook –generate-config 打开python,生成密钥:python -c “import IPython;print(IPython.lib.passwd())” 修改配置文件:

1
2
3
4
5
6
c.NotebookApp.ip = '*'
c.NotebookApp.allow_root = True
c.NotebookApp.open_browser = False
c.NotebookApp.port = 8888
c.NotebookApp.password = u'sha1:5b9916263f9e:71ff4e02de92f603b9d929eab08b41d8cf053b76'
c.ContentsManager.root_dir = '/data/home/weitao.zhang'

启动jupyter: jupyter notebook 访问:ip:8888

java9版本的jupter插件

1
2
3
4
5
1.java --list-modules | grep "jdk.jshell"
2.pip3 install jupyter
3.git clone https://github.com/frankfliu/IJava.git
4.cd IJava/
5../gradlew installKernel

安装启动jupyter lab

1
2
pip install jupyterlab
jupyter lab

java8安装jupyter

1
2
3
4
5
6
7
8
1.conda config --add channels conda-forge
2.conda create --name java_env scijava-jupyter-kernel
3.source activate java_env
4.jupyter kernelspec list
5.jupyter notebook or jupyter lab
6.配置依赖
.#!groovy
#@dependency(group="org.jpmml", module="pmml-evaluator-extension", version="1.4.1")

报错:Permission denied: ‘/run/user/999/jupyter’

1
export XDG_RUNTIME_DIR="/home/deploy/.virtualenvs/ironbank"

ssh -NfR localhost:8888:localhost:8888 username@ip

crontab

1
2
3
4
1.service crond status:查看状态
2.30 0 * * *  root anaconda3/bin/python  /home/upload/py/test.py
3.最好用拥有roott账户权限的账号登录
4.service crond restart  重启

参考

  1. coscmd
  2. pypinyin
  3. kaldi安装
  4. kaldi安装问题