0

I am having hard time to effectively switch between 64bit Python and 32bit.

1- I followed steps described here (Using multiple Python engines (32Bit/64bit and 2.7/3.5))

2- I successfully got a 2nd channel Python 3.6 32bit on my Anaconda Navigator

3- When I start Spyder, it is still running on 64bit interpreter

4- I forced the interpreter to launch the 32bit from: "Tools-->Python Interpreter-->Use the following Interpreter" then I navigate to the 32bit python.exe file created by the 2nd channel

Yet it is still running on 64bit (I confirmed on spyder menu Help --> About Spyder... as well as by typing python in anaconda prompt)

I need the 32bit python to call some DLLs using ctypes. If I don't do that I get the following error message:

OSError: [WinError 193] %1 is not a valid Win32 application

I tried to load a different DLL (64bit) and I didn't have any issues

If using pythonnet (clr), I am getting this error message:

FileNotFoundException: Unable to find assembly

Note: this post (PythonNet FileNotFoundException: Unable to find assembly) reported similar issue using clr, but I can't find: Properties-->General-->Unblock

Thanks for your help

Simple Engineer
  • 67
  • 1
  • 3
  • 11
  • Try to use shebang – Smart Manoj Jun 05 '19 at 03:19
  • @SmartManoj sorry I am not used to shebang, what is it? according to my quick search, it seems to be related to linux, but i am a windows user... or am I mistaken? – Simple Engineer Jun 05 '19 at 05:57
  • Works on windows too. `#!python3.6` For 64 bit & `#!python3.6-32` For 32 bit – Smart Manoj Jun 05 '19 at 06:02
  • [In CMD "python" starts Python 3.3, "py" starts Python 2.7, how do I change this?](https://stackoverflow.com/a/21257622) – Smart Manoj Jun 05 '19 at 06:05
  • @SmartManoj the question is about using different Python versions with Anaconda and Spyder, not just when running a script. – nekomatic Jun 05 '19 at 10:00
  • So your Anaconda install is 64-bit and you have created a conda env where you specified the 32-bit Python you want to use. Have you installed Spyder into that environment and activated that environment before starting Spyder? Doing that from the Anaconda prompt is the most reliable method if you're having trouble in Navigator. I don't know if you're going to be able to switch between 64-bit and 32-bit Python interpreters in the same Spyder session if that's what you're asking. – nekomatic Jun 05 '19 at 10:06
  • (*Spyder maintainer here*) I think the easiest thing for you is to also install Spyder in your 32 bit env and run it from there (instead of using your 64 bit Spyder to load you 32 bit env in our IPython console). – Carlos Cordoba Jun 05 '19 at 11:40
  • @CarlosCordoba, nekomatic, Thank you very much for your comments, I already did that yesterday, and I realized that it is the "same" Spyder that is launched...is it normal? – Simple Engineer Jun 06 '19 at 09:40

0 Answers0