How can I manage the modules for python2 when python3 installed as well. In OSX
I'm using OSX and I installed python3 with anaconda installed. In my OSX, there exists two versions of python, i.e. python2 and python3.
I managed the modules in anaconda which only affect modules in python3. But how can I manage(install, delete, update) the modules for python2?
I've checked some posts about 'python2 is at /usr/bin/python' . So it's ok to use python2 by '/usr/bin/python' without configuring alias. But, how can I manage(install, delete, update) the modules for python2 when python3 installed as well. In OSX.
Anaconda comes with a package and environment manager called conda. This is what you need to do:
Create a separate Python 2.7 environment, let's call it old and busted.
conda create --name old_and_busted python=2.7
Now switch to this environment:
conda activate old_and_busted
Verify it worked if you want:
python --version
Install some modules cool:
conda install flask
Bonus, use pip to install something cool in the same environment:
pip install flask
What environment are we in again?
conda env list
Let's check for that package:
conda list
Now this part is very important, make sure to do it often - go back to your Python 3 environment:
conda activate base
pipenv manages environments in a similar way. Anaconda specializes in packaging for scientific computing handling packaging non-python extensions (e. g. C, C++) dependencies well.
** Note on conda vs source for environment activation **
If conda activate does not work use source activate. This was changed in Anaconda 4.4.0.
If you have this in your .bash_profile (or .profile or other magical dotfile) you use source activate:
export PATH="$HOME/anaconda3/bin:$PATH"
If you have this updated code in your shell startup then you can use conda activate:
. $HOME/anaconda3/etc/profile.d/conda.sh
conda activate
How can I manage the modules for python2 when python3 installed as well. In OSX的更多相关文章
- python2 与 python3 urllib的互相对应关系
urllib Python2 name Python3 nameurllib.urlopen() Deprecated. See urllib.request.urlopen() which mirr ...
- 在同一台电脑上同时安装Python2和Python3
目前Python的两个版本Python2和Python3同时存在,且这两个版本同时在更新与维护. 到底是选择Python2还是选择Python3,取决于当前要使用的库.框架支持哪个版本. 例如:HTM ...
- python2与python3在windows下共存
python有python2(工业版)和python3,有时候我们会希望电脑上既有python2也有python3,!假设我们已经安装好,python2和python3了, 接下来我们找到python ...
- Python2.7<-------->Python3.x
版本差异 from __future__ Python2.7 Python3.x 除法 / // Unicode u'' ...
- 同时使用python2和Python3
问题:thrift生成的是python2代码,之前使用的是Python3因此需要同时使用两个版本. 方案:将python3的可执行文件重命名为python3(默认为Python),这样使用pyhton ...
- python2 到 python3 转换工具 2to3
windows系统下的使用方法: (1)将python安装包下的Tools/Scripts下面的2to3.py拷贝到需要转换文件目录中. (2)dos切换到需要转换的文件目录下,运行命令2to3.py ...
- windows下同时安装python2与python3
由于python2与python3并不相互兼容,并且差别较大,所以有时需要同时安装,但在操作命令行时,怎么区别python2与python3呢? 1.下载并安装Python 2.7.9和Python ...
- 爬虫入门---Python2和Python3的不同
Python强大的功能使得在写爬虫的时候显得十分的简单,但是Python2和Python3在这方面有了很多区别. 本人刚入门爬虫,所以先写一点小的不同. 以爬取韩寒的一篇博客为例子: 在Python2 ...
- python2 和python3共存下问题
一.使用python2 or python3 1. 使用python2 $ python xxx.py 2. 使用python3 $ python3 xxx.py 二.脚本调用 /usr/bin/en ...
随机推荐
- @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) 注解的作用
在学习boot 项目的时候 ,发现在启动类中有一个这个的注解 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) ...
- 1095 解码PAT准考证
PAT 准考证号由 4 部分组成: 第 1 位是级别,即 T 代表顶级:A 代表甲级:B 代表乙级: 第 2~4 位是考场编号,范围从 101 到 999: 第 5~10 位是考试日期,格式为年.月. ...
- c# 抽象类与接口【学习笔记】
最近一直在学着面向接口编程,总是会写出好多的接口然后继承,现在开始发现了一些好处,就是在一个方法里面使用另一个方法的时候, 用接口代替这个被使用的方法,可以减少代码的耦合,后期的扩展也方便,代码易于维 ...
- L328 What Is Millennial Burnout?
What Is Millennial Burnout?Do you often feel stressed? Does the pace of life make you feel like you' ...
- java面向对象编程(一)-类与对象
1.问题的提出 张老太养了两只猫猫:一只名字叫小白,今年3岁,白色.还有一只叫小花,今年100岁,花色.请编写一个程序,当用户输入小猫的名字时,就显示该猫的名字,年龄,颜色.如果用户输入的小 ...
- 如何执行Python代码
1.在linux系统中执行代码有两种方法 a.在脚本的当前目录下执行:python test.py b.给脚本赋予可执行权限,然后执行代码 chmod +x test.py test.py 2.在wi ...
- 如何理解Minkowski不等式
[转载请注明出处]http://www.cnblogs.com/mashiqi 2017/02/16 Minkowski不等式: 设$f$是$\mathbb{R}^n \times \mathbb{R ...
- 消息队列MQ】各类MQ比较
目前业界有很多MQ产品,我们作如下对比:RabbitMQ 是使用Erlang编写的一个开源的消息队列,本身支持很多的协议:AMQP,XMPP, SMTP, STOMP,也正是如此,使的它变的非常重量级 ...
- python:用wordcloud生成一个文本的词云
今天学习了wordcloud库,对<三国演义>生成了词云图片,非常漂亮.就想多尝试几个,结果发现一系列问题.最常出现的一个错误就是"UnicodeDecodeError : .. ...
- PythonStudy——数据类型 Type of data
数据类型:信息存在的状态为什么要来描述事物的具体状态:不同的事物需要不同的状态加以描述可以达到描述的最优化 python中有哪些常见的数据类型 1.整型 num = 10000000000000000 ...