0

I have a 64 bit PC, and python 3.6.2 (64 bit), python 3.5.4 (32 bit), and python 3.5.4 (64 bit), all installed and added to my path.

In Pycharm, I created a virtual environment based off of python 3.5.4 (32 bit) and wrote a project in this env. Each version of python I have installed has an associated virtual env, and all of them have pyinstaller installed on them via Pycharm's installer.

However, when I open up a command prompt in the project folder and type

pyinstaller -F project_name.py

it spits out a .exe that only runs on 64 bit machines. Everything is tested and works perfectly well on 64 bit PCs, but I get an error on 32 bit PCs asking me to check whether or not the system is 32 bit or 64 bit.

How can this be possible, and how do I fix it?

EDIT: It seems as though pyinstaller is accessing the python35 folder instead of the python35-32 folder when running. How do I stop this?

Johnny Apple
  • 199
  • 2
  • 10
  • PyInstaller builds the architecture depending on the architecture of python installed and used. Best if your build it using 32 bit python and then you can easily share with both 32 or 64 bit machines. See the following answer [link](https://stackoverflow.com/questions/7155866/can-i-control-the-architecture-32bit-vs-64bit-when-building-a-pyinstaller-exec) – aspo Sep 03 '17 at 21:59
  • I have all 3 versions of Python installed, though, and the virtual env within which I'm working is based off of 32 bit Python 3.5. – Johnny Apple Sep 03 '17 at 22:00
  • Please check that it is not using the 64 bit, that may be the issue – aspo Sep 03 '17 at 22:14
  • How do I check this, and how do I stop it from using this if it is? – Johnny Apple Sep 03 '17 at 22:14
  • Please see the following suggestions [link1](https://stackoverflow.com/questions/22681824/how-to-use-different-python-version-in-venv-from-standard-library-not-virtuale),[link2](https://stackoverflow.com/questions/45293436/how-to-specify-python-version-used-to-create-virtual-environment). – aspo Sep 03 '17 at 22:32
  • The problem is, my virtual environments are made in PyCharm, and I have followed the instructions very carefully, making sure that the virtual environment is built on the correct version of Python. – Johnny Apple Sep 03 '17 at 22:45
  • Then change the Project interpreter in settings for Pycharm to use the 32-bit python when executing the code – aspo Sep 03 '17 at 22:47
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/153576/discussion-between-johnny-apple-and-deaspo). – Johnny Apple Sep 03 '17 at 22:48

1 Answers1

0

It seems like your Pyinstaller is using the wrong version of Python, to make it use the correct one you probably want to use an explicit declaration of what Python interpreter you're using.

It's normally something like python -m pyinstaller {args} but other ones could be python3.5

I'd recommend using a virtual environment so you're sure what Python interpreter you're using.

  • In my post, you'll see I made a virtual environment in PyCharm using 35-32 as a base. I don't know why, but PyInstaller seems to want to use regular Pythin35. How can I fix this? – Johnny Apple Sep 03 '17 at 23:27