Using Multiple Python Engines (32Bit/64Bit and 2.7/3.5)

Using multiple Python engines (32Bit/64bit and 2.7/3.5)

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

Create a new environment for 32bit Python 2.7:

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

Activate it:

set CONDA_FORCE_32BIT=1
activate py27_32

Deactivate it:

deactivate py27_32

Create one for 64 bit Python 3.5:

set CONDA_FORCE_32BIT=
conda create -n py35_64 python=3.5

Activate it:

set CONDA_FORCE_32BIT=
activate py35_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.

UPDATE

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

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. ...

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.

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

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.

How can I have two different environments within Anaconda? (both Python 3.7, one 32bit and one 64bit)

You can specify the 32-bit channel manually using the --channel/-c flag when using conda create.

You just need to supply the correct url for the channel and subdir you want to use. The --override-channels flag prevents the 64-bit channels from being pulled in (shouldn't matter, but your never know).

conda create -n py32 python=3.7 -c https://repo.anaconda.com/pkgs/main/win-32 --override-channels
conda activate py32

In your case, I would recommend installing the 64-bit version of Anaconda or Miniconda, then create the 32-bit environment.

How to create a 32 bits exclusive conda env

Follwing commands will successfully get a 32-bit python. I suppose the main problem is the environment variable. You know windows is this. :(

conda create -n py27_32
conda activate py27_32
conda config --env --set subdir win-32
conda install python=2.7

Sample Image

useful links:

  1. Using multiple Python engines (32Bit/64bit and 2.7/3.5)
  2. How can I have two different environments within Anaconda? (both Python 3.7, one 32bit and one 64bit)
  3. https://github.com/conda/conda/issues/1744

How to create python conda 64 bit environment in existing 32bit install?

As I understand, Anaconda installs into a self-contained directory (<pwd>/anaconda3). Since 64-bit and 32-bit builds of Python can not be mixed or converted into each other (in terms of the compiled Python binaries and libraries in site-packages or other PYTHONPATH location), you have to go with a second (64-bit) Anaconda installation in another directory.

If you have 32-bit code that needs to call 64-bit code, you have to rely subprocesses and pipes (or other IPC mechanisms). You probably have to be careful about your environment variables, e.g. PATH and PYTHONPATH when doing so.

Python upgrade to 3.5 from 2.7 for a different project using virtualenv in windows 10

You can have multiple virtual environments .
Just create one more virtual environment and activate it then install Python 3.5 and required Django .

You can download Anaconda, after the installation from cmd type this:

conda create --name environmentname python=3.5

after installation just type:

activate environmentname

then just type :

pip install django

Hope it helps.



Related Topics



Leave a reply



Submit