1、指定python包安裝版本== 指定python包安裝源-i:
pip2 install matplotlib==2.2.3 -i https://pypi.tuna.tsinghua.edu.cn/simple
2、配置文件换源
vi ~/.pip/pip.conf [global] timeout = 6000 index-url = http://pypi.douban.com/simple/ [install] use-mirrors = true mirrors = http://pypi.douban.com/simple/ trusted-host = pypi.douban.com
3、为python setup.py install命令换源
vi ~/.pydistutils.cfg [easy_install] index_url = http://pypi.douban.com/simple
pip
Ubuntu系统内置python2.7,为python2安装pip:
sudo apt-get install python-pip
为python3安装pip:
sudo apt-get install python3-pip
注意:上面两条命令安装过程中可能报错,我运行的时候报错提示 unable to fetch archives...try apt-get update or --fix-missing
才反应过来:
使用apt-get之前需要先更新一下apt-get:执行sudo apt-get update,再执行安装,即可
安装conda
https://www.continuum.io/downloads
http://blog.csdn.net/qq_26898461/article/details/51485491
从官网下载安装包(.sh文件),运行即可,中间会提示你是否同意用户协议,询问你安装路径,询问你是否要将 %condahome%/bin加入环境变量,询问你是否还要安装其捆绑软件vscode。
安装完成后,执行conda命令,发现command not found:
-bash: conda: command not found
猜测可能是配置的环境变量还没生效?于是进入%condahome%/bin然后执行conda命令,发现出现了更加奇怪的错误:
from: can't read /var/mail/conda.cli
bash: ./conda: line 10: syntax error near unexpected token `('
bash: ./conda: line 10: ` sys.argv[0] = re.sub(r'(-script.pyw?|.exe)?$', '', sys.argv[0])'
最后发现是因为安装完成后需要关闭然后重新打开一个terminal才能使用conda命令!
卸载conda(anaconda)
http://blog.csdn.net/qq_22474567/article/details/54984257