美文网首页
pip 豆瓣源 Linux or Win7 And 杂项记录

pip 豆瓣源 Linux or Win7 And 杂项记录

作者: single430 | 来源:发表于2017-02-28 18:00 被阅读63次
    • Linux

    修改 /home/xxx/.pip/pip.conf 如果没有就新建####

    [global]
    index-url = https://pypi.doubanio.com/simple/
    or
    [global]
    trusted-host=mirrors.aliyun.com
    index-url=http://mirrors.aliyun.com/pypi/simple/
    

    • Win7

    修改 C:\Users\Administrator\AppData\Local\pip\pip.ini 如果没有就新建####

    [global] 
    index-url = https://pypi.douban.com/simple 
    [install] 
    trusted-host=pypi.doubanio.com ```
    ***
    
    * ###Ubuntu apt源
    ```javascript
    修改 /etc/apt/source.list
    #deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
    # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    # newer versions of the distribution.
    deb http://mirrors.sohu.com/ubuntu/ xenial main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ xenial-security main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ xenial-updates main restricted universe multiverse
    deb http://mirrors.sohu.com/ubuntu/ xenial-backports main restricted universe multiverse
    ##测试版源
    deb http://mirrors.sohu.com/ubuntu/ xenial-proposed main restricted universe multiverse
    # 源码
    deb-src http://mirrors.sohu.com/ubuntu/ xenial main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ xenial-security main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ xenial-updates main restricted universe multiverse
    deb-src http://mirrors.sohu.com/ubuntu/ xenial-backports main restricted universe multiverse
    

    • 问题 sudo: 无法解析主机: xxxxx

    修改 /etc/hosts

    加入 127.0.1.1  xxxxx
    xxxxx是你的机器名(也就是命令行@后的那一串)```
    ***
    
    * ###nginx配置server name 不能访问
    ```javascript
    需要在 /etc/hosts 中配置一下
    127.0.0.1        www.xxx.com
    之后重启nginx就好了
    

    • Linux 配置Java环境

    下载地址 http://download.csdn.net/detail/tan3739/9760242
    在 vi ~/.bashrc 最后添加下面,保存 source ~/.bashrc
    #set jdk environment
    export JAVA_HOME=/usr/local/lib/java/jdk1.8.0_121  ## 这里要注意目录要换成自己解压的jdk 目录
    export JRE_HOME=${JAVA_HOME}/jre  
    export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
    export PATH=${JAVA_HOME}/bin:$PATH 
    

    • Linux 配置GO环境

    在 vi ~/.bashrc 最后添加下面,保存 source ~/.bashrc
    export GOROOT=/usr/local/go
    export GOPATH=/home/zbl/go
    export GOBIN=$GOROOT/bin
    

    • ubuntu 安装scrapy问题

    ubuntu + python3
    sudo pip3 install scrapy
    

    报错:


    error.png
    然后 sudo apt-get install libssl-dev 再安装就好了```
    ***
    * ###Html 页面粒子效果(Canvas)
    ```javascript
    需要的js自己可以搜索下载
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Canvas</title>
        <script type="text/javascript" src="./jquery.js"></script>
        <script type="text/javascript" src="./canvas-particle.js"></script>
    </head>
    <body>
    <canvas width="1905" height="419" style="position: absolute; top: 0px; left: 0px; z-index: -1;"></canvas>
    </body>
    </html>
    

    • TensorFlow 依赖安装

    pip install numpy==1.8.2
    sudo apt-get install python-scipy
    sudo apt-get install python-numpy
    sudo apt-get install python-matplotlib
    
    terminator 字体设置
    Ubuntu Mono 12
    

    • 记录

    1: 查看log后20行的每行的前200字符
      awk '{print substr($0, 0, 200)}' data.log | tail -20
    
    2: awk 分割字符串
      echo '1234qw212' | awk -F 'qw' '{print $1 "-" $2}'
      1234-212
    
    3: 按照文件每行长度排序
    tset.txt
    qwe
    ewewew
    qw
    dedefefe
     
    awk '{print $1 ":" length($1)}' test.txt | sort -n -t : -k 2 | awk -F ":" '{print $1}'
     
    输出:
    qw
    qwe
    ewewew
    dedefefe
    
    防止rm出错,重定向rm,在 .bashrc 文件最后添加,save, source .bashrc
    alias rm=trash
    alias clt=cleartrash
    trash()
    {
      mv $@ ~/.local/share/Trash/files/
    }
    cleartrash()  # 这个函数的作用是清空回收站目录下的所有文件
    { 
        read -p "clear sure?[n]" confirm  
        [ $confirm == 'y' ] || [ $confirm == 'Y' ]  && /bin/rm -rf ~/.local/share/Trash/files/*  
    }
    
    
    • 系统时间设为北京时间 - ubuntu

    亲测可用

    sudo tzselect
    选择**Asia**>**China**>**Beijing Time**>**yes**
    sudo cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime
    sudo ntpdate time.windows.com
    如果设置crontab任务,需要重启服务
    sudo service cron restart
    

    ubuntu server设置时区和更新时间

    记录一下,以防忘记

    相关文章

      网友评论

          本文标题:pip 豆瓣源 Linux or Win7 And 杂项记录

          本文链接:https://www.haomeiwen.com/subject/qotfgttx.html