Use conda to install 64-bit python and 32-bit python to coexist

Today, we need to call a dll dynamic function library, but the local python is 64-bit, and the dll is 32-bit. If you call it directly, you will get an error.

OSError: [WinError 193] %1 不是有效的 Win32 应用程序。

Python version: 3.6
Anaconda is still very convenient for the management of the python version, so anaconda is used here to achieve the coexistence of 32-bit and 64-bit python.
1. Open the anaconda prompt and enter  conda info , you can see that the 64-bit version is currently used.

Insert picture description here
2. If you switch to 32-bit,  set CONDA_FORCE_32BIT=1 you can see that you have switched to 32-bit.
Insert picture description here
3. After installing 32-bit python3.6,  conda create -n python32 python=3.6
Insert picture description here
there will be an envs folder under the anaconda3 folder.
Insert picture description here
4. Activate the environment  conda activate python32 . If you want to cancel  conda deactivate python32, if To delete the environment  conda remove -n python32--all
5. If you want to use the environment in pycharm,
Insert picture description here
click add local and
Insert picture description here
click ok.

Guess you like

Origin blog.csdn.net/THMAIL/article/details/113818343