有个Django的项目,需要python3.4环境,但我的 ubuntu16.04 里之前已安装了python3.5,我sudo apt-get install python3.4
老是安装不了,显示:根据正则表达式“python3.4”选中了‘libpython3.4-minimal’。
尝试卸载python3.5,sudo apt-get remove python3.5, apt-get removeall python3.5
都不管用,执行python3.5依旧存在。
如何安装python3.4? 如何彻底卸载python3.5?
ringa_lee2017-04-17 17:52:14
It is generally not recommended to uninstall the python that comes with the system
Please use virtualenv
Uninstalling the python that comes with the system may cause problems
巴扎黑2017-04-17 17:52:14
Why not use virtualenv
或者pyenv
, a standard multi-version coexistence solution
怪我咯2017-04-17 17:52:14
Python3.5 is dependent on the system and cannot be uninstalled. You can try it
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get -y install python3.4
怪我咯2017-04-17 17:52:14
In the ubuntu16.04 x64 server
virtual machine, searching for apt search python3.4
yielded no results. I also tried more variant matching methods but yielded no results. ubuntu16.04 x64 server
虚拟机, 搜索apt search python3.4
无结果. 也试了更多变种的匹配方式也无结果.
事实上, 官方软件仓库中通常不会存储有一个软件或库的多个版本, 而会选择当前的最新稳定版.
因此, 推荐使用多版本环境管理. 除了上述工具, 也可使用conda
. 推荐理由是, 由大公司维护, 在python
官方软件源外, 还维护有一个包含大量科学计算包的源, 其中所有的包都维持最新版本.
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
chmod u+x Miniconda3-latest-Linux-x86_64.sh && ./Miniconda3-latest-Linux-x86_64.sh
conda create -n py3.4 [pkg1, pkg2...] python=3.4 #创建python3.4环境, 可同时安装指定包
conda remove -n py3.4 --all #删除环境及其所有包
source activate py3.4 #切换到py3.4环境, 则当前python版本为3.4
source deactivate #还原之前的环境
创建环境时, 可指定anaconda
, 其是一个包组, 包含完整的科学计算包.
这里推荐设定两个别名, alias py3.4='source activate py3.4'
和alias py-='source deactivate'
. 注意, 别名是py-
, 意为去除环境.
更多命令参数, 运行conda --help
conda
. The reason for recommendation is that it is maintained by a large company. In addition to the official software source of python
, there are also Maintains a repository containing a large number of scientific computing packages, all of which are kept at the latest version.🎜
rrreee
🎜When creating an environment, you can specify anaconda
, which is a package group that contains complete scientific computing packages. 🎜
🎜It is recommended to set two aliases here, alias py3.4='source activate py3.4'
and alias py-='source deactivate'
. Note that the alias is < code>py-, means to remove the environment.🎜
🎜For more command parameters, run conda --help
to get them.🎜