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 ...
随机推荐
- 远程连接Linux
远程连接Linux 为什么要远程连接Linux 在实际的工作场景中,虚拟机界面或者物理服务器本地的终端都是很少接触的,因为服务器装完系统之后,都要拉倒IDC机房托管,如果是购买的云主机,那更碰不到 ...
- RN环境的搭建
RN技术详细了解: RN环境的搭建: 1. 首先安装node.js 2. 安装homebrew(网上内容很多自己找,详细的我就不多说了) (1) 在home ...
- linux 服务发布脚本升级,远程发布,指定拉取远程dev,test等分支代码
1.本地发布脚本 publish.sh #!/bin/sh currentDay=`date +%Y%m%d` currentTime=`date +%Y%m%d%H%M%S` tomcat1=/da ...
- 解决Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find resource com/cqupt/paging/dao/User.xml
搭建了一个ssm项目,启动报错Error parsing SQL Mapper Configuration. Cause: java.io.IOException: Could not find re ...
- matlab学习(4) any 和cellfun用法
1.对于向量来说,只要包含非0元素,则返回为1: 2.对于矩阵来说,any(X)依次判断X的每一列是否为ture,返回一个含0或1的向量. 3.any(X,DIM)对X的第DIM维操作, DIM=1即 ...
- python 的排名,已经python的简单介绍
我在今天看了一篇文章,是简书的全网程序猿写的,Java已经退出神坛,python稳居第一. python是由龟叔写的,它在英文的意思是蟒蛇. 根据编程语言流行指数排行榜2019年2月的榜单 据了解,目 ...
- 基于python的发送邮件案例
#coding:utf-8 #强制使用utf-8编码格式 import smtplib #加载smtplib模块 from email.mime.text import MIMEText from e ...
- struct 和typedef struct
1.typedef (1)typedef的使用 定义一种类型的别名,而不只是简单的宏替换(见陷阱一).用作同时声明指针型的多个对象 typedef char* PCHAR; // 一般用大写,为cha ...
- 关于IE无法访问本机网络的问题
多次遇到IE无法访问本机站点的情况,比如架设了一个花生壳,所有人都可以访问,唯独本机不行(服务器),还需要把这个域名加入信任站点,这TMD什么情况.今天又遇到访问本地restful service,用 ...
- Windows下struct和union字节对齐设置以及大小的确定(一 简介和结构体大小的确定)
在windows下设置字节对齐大小的方式,目前我了解有三种: 1. 在编译程序时候的编译选项 /Zp[n],如 cl /Zp4 表示对齐大小是4字节: 2. 预处理命令 #pragma pack ...