使用多个Python引擎(32位/64位和2.7/3.5) [英] Using multiple Python engines (32Bit/64bit and 2.7/3.5)

查看:85
本文介绍了使用多个Python引擎(32位/64位和2.7/3.5)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将Python用于科学应用程序,经过一些研究决定,我将使用Anaconda,因为它与大量程序包捆绑在一起,并易于通过cmd使用conda install添加新模块.

I would like to use Python for scientific applications and after some research decided that I will use Anaconda as it comes bundled with loads of packages and add new modules using conda install through the cmd is easy.

我更喜欢使用64位版本,以提高RAM使用率和效率,但是 还需要32位版本,因为某些库是32位的.同样,我更喜欢使用Python 3.5,因为这是未来和事情的发展方向.但是库的负载仍然是2.7,这意味着我需要两者.

I prefer to use the 64 bit version for better RAM use and efficiency but 32bit version is needed as well because some libraries are 32bit. Similarly, I prefer to use Python 3.5 as that is the future and the way things go. But loads of libraries are still 2.7 which means I need both.

我必须安装Anaconda的4个版本(64位2.7、64位3.5、32位2.7、64位3.5).每个版本大约380MB.我的目标是使用Jupyter笔记本电脑和Spyder作为IDE.需要时,我必须在版本之间切换.我遇到了冲突的库,路径问题以及各种奇怪的问题.

I have to install 4 versions of Anaconda (64bit 2.7, 64bit 3.5, 32bit 2.7, 64bit 3.5). Each version is about 380MB. I am aiming to use Jupyter notebook and Spyder as the IDE. I had to switch between versions when required. I had conflicting libraries, path issues and all sorts of weird problems.

因此,我打算从头开始进行全新安装.我想知道是否有更明智的方式来处理此问题.如果有问题,我现在使用Windows 7 64位.

So, I am planning to do a clean install from scratch. I would like to know if there is a more sensible way to handle this. I use Windows 7 64 bit for now if that matters.

推荐答案

请确保设置正确的环境变量(

Make sure to set the right environmental variables (https://github.com/conda/conda/issues/1744)

为32位Python 2.7创建新环境:

Create a new environment for 32bit Python 2.7:

set CONDA_FORCE_32BIT=1
conda create -n py27_32 python=2.7

激活它:

set CONDA_FORCE_32BIT=1
activate py27_32

停用它:

deactivate py27_32

为64位Python 3.5创建一个:

Create one for 64 bit Python 3.5:

set CONDA_FORCE_32BIT=
conda create -n py35_64 python=3.5

激活它:

set CONDA_FORCE_32BIT=
activate py35_64

最好将激活命令写在批处理文件中,这样您只需键入一个命令,就不会忘记设置正确的32/64位标志.

The best would be to write the activation commands in a batch file so that you have to type only one command and cannot forget to set the right 32/64 bit flag.

更新

您不需要为此安装完整的Anaconda发行版. Miniconda 就足够了:

You don't need to install a full Anaconda distribution for this. Miniconda is enough:

这些Miniconda安装程序包含conda软件包管理器和Python.安装Miniconda后,您可以使用conda命令安装任何其他软件包并创建环境等....

These Miniconda installers contain the conda package manager and Python. Once Miniconda is installed, you can use the conda command to install any other packages and create environments, etc. ...

安装程序有两种变体:Miniconda基于Python 2,而Miniconda3基于Python 3.请注意,选择安装哪个Miniconda只会影响根环境.无论您安装的是哪个Miniconda版本,您都可以同时安装Python 2.x和Python 3.x环境.

There are two variants of the installer: Miniconda is Python 2 based and Miniconda3 is Python 3 based. Note that the choice of which Miniconda is installed only affects the root environment. Regardless of which version of Miniconda you install, you can still install both Python 2.x and Python 3.x environments.

我建议您使用64位Miniconda3作为您的根环境.

I would recommend you to use Miniconda3 64-bit as your root environment.

您以后总是可以通过以下方式安装完整的Anaconda:

You can always install a full Anaconda later with:

conda install anaconda

注意,它可能会降级您在活动环境中以前安装的某些软件包.

Note that it might downgrade some of your previously install packages in your active environment.

这篇关于使用多个Python引擎(32位/64位和2.7/3.5)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆