Ubuntu16.04 nvidia-docker下安装python3.6 和 pip
Ubuntu16.04 nvidia-docker下安装python3.6 和 pip
执行apt-get install python3.6 失败
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package python3.6
E: Couldn’t find any package by glob ‘python3.6’
E: Couldn’t find any package by regex ‘python3.6’
1.添加ppa到系统
add-apt-repository ppa:jonathonf/python-3.6
成功显示
A plain backport of just Python 3.6. System extensions/Python libraries may or may not work.
Don’t remove Python 3.5 from your system - it will break.
More info: https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6
Press [ENTER] to continue or ctrl-c to cancel adding it # 按enter键进入下一步
Error: retrieving gpg key timed out.
gpg: keyring/tmp/tmp9q8igw_p/secring.gpg' created gpg: keyring
/tmp/tmp9q8igw_p/pubring.gpg’ created
gpg: requesting key F06FC659 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp9q8igw_p/trustdb.gpg: trustdb created
gpg: key F06FC659: public key “Launchpad PPA for J Fernyhough” imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
OK
2.更新
apt-get update
3.安装
apt-get install python3.6
安装成功
修改python命令指向
1.首先查看命令指向
ls -l /usr/bin | grep python
python指令默认指向2.7版本
2.删除原软链接
rm /usr/bin/python
3.建立python到python3.6新的软链接
ln -s /usr/bin/python3.6 /usr/bin/python
成功建立新链接
安装pip
1.使用apt-get install python3-pip安装失败
指向是python3.5 下的pip
输入 pip --version
显示 pip 19.1.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
2.换个方式安装pip
1.先将指向python3的命令也链接为python3.6
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2
update-alternatives --config python3
成功更改!
2.继续装pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --force-reinstall
完成安装pip:
pip 19.1.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
接下来就可以用pip安装numpy,scipy,pandas 等。
注:参考文章:
推荐阅读
-
Linux下安装python3.6和第三方库的教程详解
-
pip在Linux和windows下的安装和使用
-
ubuntu16.04环境下安装anacoda2和TensorFlow1.9
-
Linux下升级python和安装pip的详解
-
Ubuntu16.04上使用Anaconda3的Python3.6的pip安装UWSGI报错解决办法
-
Ubuntu16.04下安装CUDA8.0,CUDNN和tensorflow,并利用Pycharm连接远程服务器实现远程调试
-
windows下python和pip安装教程
-
Ubuntu16.04下安装搭配Python3.6相关配置软件方法
-
Linux下安装python3.6和第三方库的教程详解
-
Centos下实现安装Python3.6和Python2共存