python,浏览器等新环境配置

记录python,浏览器等新环境配置操作步骤

Posted by WW on April 6, 2021

安装FireFox

https://linuxconfig.org/how-to-install-uninstall-and-update-firefox-on-ubuntu-20-04-focal-fossa-linux

Install Firefox

  1. First, we need to add the Mozilla signing key to our system:
    $ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A6DCF7707EBC211F
    
  2. Next, add Mozilla’s PPA repository and update the list of available packages in apt:
    $ sudo apt-add-repository "deb http://ppa.launchpad.net/ubuntu-mozilla-security/ppa/ubuntu focal main"
    $ sudo apt update
    
  3. Finally, if all went well up till now, install the latest version of Firefox with this command:
    $ sudo apt install firefox
    

安装Proxy SwitchyOmega

FireFox Proxy SwitchyOmega

Profile :: proxy

Scheme : default Protocol : HTTP Server : 127.0.0.1 Port : 9999

HTTP模式下 Port 是软件上的http端口

Profile :: auto switch

Rule List Config Format: AutoProxy Rule List URL : http://repo.or.cz/gfwlist.git/blob_plain/HEAD:/gfwlist.txt

startpage-private-search 设置 about:preferences#search 首选搜索

安装onetab

一键保存所有页面 onetab

取消启动时恢复所有页面 Preference ->Startup Restore previous session

Auto Tab Discard

页面自动休眠

其它

ublock-origin clearurls clearcache

安装chrome

设置代理

/opt/google/chrome/chrome --proxy-server="http://127.0.0.1:8889"

安装Proxy SwitchyOmega

https://chrome.google.com/webstore/detail/proxy-switchyomega/padekgcemlokbadohgkifijomclgjgif/

安装pip

Please do not use the command sudo and pip together as pip may overwrite critical system libraries which may require you to reinstall your operating system.

wget https://bootstrap.pypa.io/get-pip.py
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py

python get-pip.py
python3 get-pip.py

pypi 镜像使用帮助

国内镜像源

  • 中国科学技术大学 https://pypi.mirrors.ustc.edu.cn/simple
  • 豆瓣 http://pypi.douban.com/simple/
  • 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple
  • 阿里云:http://mirrors.aliyun.com/pypi/simple/
  • 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  • 华中理工大学:http://pypi.hustunique.com/
  • 山东理工大学:http://pypi.sdutlinux.org/

著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。 pypi 镜像每 5 分钟同步一次。

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

注意,simple 不能少, 是 https 而不是 http

设为默认,升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

pip 安装git包

pip install git+https://github.com/koneb71/scrapyd-client.git@patch-1

用户自定义安装

export PYTHONUSERBASE=/python_libs


pip install --user pkg

自动搜索安装目录 entry.sh

#!/bin/bash

export PYTHONPATH=$(find $PYTHONUSERBASE -type d -wholename "*site-packages" -print):$PYTHONPATH
export PATH=$PYTHONUSERBASE/bin:$PATH


quoted_args="$(printf "${1+ %q}" "$@")" # Note: this will have a leading space before the first arg
# echo "Quoted args:$quoted_args" # Uncomment this to see what it's doing
#echo "quoted_args ${quoted_args}"
bash -c "$quoted_args"

entry.sh jupyter

conda创建虚拟环境

python=3.7上包比较全,比如pptk在3.9 版本上找不到

conda create --name myenv python=3.7
# To activate this environment, use

conda activate myenv

# To deactivate an active environment, use

conda deactivate
conda list
conda remove --name myenv numpy
conda env remove --name myenv

安装jupyterlab

pip install jupyterlab==3

https://stackoverflow.com/questions/40536560/ipython-and-jupyter-autocomplete-not-working

%config Completer.use_jedi = False


or

!pip install --upgrade jedi==0.17.2

or

pip uninstall jedi --yes

在docker中使用

docker-compose exec work-env /app/entry.sh jupyter lab --allow-root --port 8889 --ip 0.0.0.0

https://stackoverflow.com/questions/40536560/ipython-and-jupyter-autocomplete-not-working

%config Completer.use_jedi = False

or

!pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade jedi==0.17.2

VLC player

https://appimage.github.io/VLC/