一般ubuntu下有三種python環境,1. 系統自帶python2,3;在/usr/bin路徑下;2. anaconda下安裝的python;3. anaconda下建立的env環境
dsp@dsp-system-product-name:~/caffe-ssd$ whereis pythonpython: /usr/bin/python3.6m /usr/bin/python2.7-config /usr/bin/python2.7 /usr/bin/python3.6 /usr/bin/python3.6m-config
/usr/bin/python /usr/bin/python3.6-config /usr/lib/python3.7 /usr/lib/python2.7 /usr/lib/python3.6 /etc/python2.7
/etc/python3.6 /etc/python /usr/local/lib/python2.7 /usr/local/lib/python3.6 /usr/include/python3.6m /usr/include/python2.7
/usr/include/python3.6 /usr/share/python /home/dsp/anaconda3/bin/python3.6m /home/dsp/anaconda3/bin/python3.6
/home/dsp/anaconda3/bin/python3.6m-config /home/dsp/anaconda3/bin/python /home/dsp/anaconda3/bin/python3.6-config
/usr/share/man/man1/python.1.gz
dsp@dsp-system-product-name:~/caffe-ssd$ python
python 3.6.5 |anaconda, inc.| (default, apr 29 2018, 16:14:56)
[gcc 7.2.0] on linux
type
"help
", "
", "
credits"or
"license
"for
more information.
>>>exit()
dsp@dsp-system-product-name:~/caffe-ssd$ activate py3.5bash: /home/dsp/anaconda3/bin/activate: 許可權不夠
dsp@dsp-system-product-name:~/caffe-ssd$ source activate py3.5(py3.5) dsp@dsp-system-product-name:~/caffe-ssd$ python
python 3.5.6 |anaconda, inc.| (default, aug 26 2018, 21:41:56)
[gcc 7.3.0] on linux
type
"help
", "
", "
credits"or
"license
"for more information.
-當我們將:/home/dsp/anaconda3/bin新增到環境變數中時,用python命令得到時anaconda下的python環境;
然後如果時env環境,直接進入建立的虛擬環境即可;
dsp@dsp-system-product-name:~/caffe-ssd$ echo $path- 如果時系統自帶的環境,python2,3切換: linux下切換python2和python3/home/dsp/pycharm-community-2017.3.3/bin:/home/dsp/anaconda3/bin:/usr/local/cuda-9.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
- 或者,待驗證
python2切換到python3:echo alias python=python3 >> ~/.bashrc
source ~/.bashrc
python3切換到python2:gedit ~/.bashrc
#alias python=python3
source ~/.bashrc
ubuntu 環境下python安裝
ubuntu 14.04 16.04 版本預設是安裝的是python 2.7 1 檢視當前python版本 python version 2 公升級到python3.x版本 sudo add apt repository ppa fkrull deadsnakes 新增乙個源 sudo apt ge...
Ubuntu下python環境搭建
一般ubuntu系統會自帶安裝python2.x 和python3.x兩個版本。我使用的ubuntu16.04自帶python2.7和python3.5.我們只需要安裝pip以及virtualenv 管理python環境,多專案部署時python環境隔離,避免相互影響 安裝python2的pip執行...
Ubuntu下安裝Python環境
在終端輸入以下命令 wget org ftp python 3.6 4 python 3.6 4.tgz tar xvzf python 3.6 4.tgz cd python 3.6 4 configure with ssl make sudo make install輸入sudo passwd ...