how to pip install 64 bit packages while having both 64 bit and 32 bit versions?

Question:

I have decided to learn generic algorithms recently and I needed to install Tensorflow package. Tensorflow run on python 64 bit only, so i install python 3.5.0 64 bit without uninstalling python 32 bit. because i was afraid to lose my packages on python 32 bit by uninstalling it. The problem is how can i force pip install to install a package on my python 64 bit version instead of 32 bit version.

Asked By: Mohsen Haddadi

||

Answers:

If you have actually managed to install both x64 & x32 packages, you could simply do

C:pathtocorrespondingpython.exe -m pip install <package>

This will ensure you use the correct pip and install the package for the specific python instance.

Answered By: shad0w_wa1k3r

Starting with Python 3.3, coexistence is made much easier with the Python Launcher for Windows. (Also see PEP 397.) From the command line you can use “py” or “pyw” in place of “python” or “pythonw”. The py command allows you to specify the revision and version of python to run. For example, open a command window and type in “py -3”. This runs the latest revision of python 3 available and defaults to the 64 bit version if it is available. On the original poster’s system, entering this command will start the python 3.5-64 bit interpreter.

This command can also be used to run the correct version of pip without knowing the exact path to the python version you want to install to. “py -3.5 -m pip install [package]” will install [package] to the 64 bit version of python3.5.

If you have both the 64 and 32 bit versions installed and ever need to install to the 32 bit version, you have to enter both the major and minor revision numbers as part of the command and add ‘-32’ to the command argument. “py -3.5-32 -m pip install [package]” will install to the 32 bit version.

Answered By: Seawolf2913

I have both 64 and 32 bit python environments on my machine.

To build targeting 32 bit or 64 bit, i edit the environment variables setting the PATH for the whole python installation and one environment variable pointing to the scripts area, where pyinstaller is.

.....Continuumanaconda3_32bit
.....Continuumanaconda3_32bitScripts
 or 
.....Continuumanaconda3
.....Continuumanaconda3Scripts

The I run pip install pyinstaller (which uses the PATH to find the required versions of PIP and pyinstaller).

The app must have been built using the correct python environment as well.

Answered By: Ben Matthews

There’s nothing much you can do. I also had this issue. The best thing to do is to change your python path and install the packages on the 64 bits python.

Answered By: AYIBO ROBERTS

If you do have both the 64 and 32 bit versions installed and need to install a 32 bit version package only, you have to enter the target -t (32 bit Lib) with pip3, e.g. install bitcoin lib:

 pip3 install -t C:Users
       maxAppDataLocalProgramsPythonPython36-32Lib bitcoin
Answered By: Max Kleiner

As an additional solution it’s good to know that windows (or any) operating system looks for apps firstly in current directory then check path environment variable. So it’s a good idea to place preferred python version’s path to first position in path env variable.
Or simply replace the old pythons’s path with new one.

Answered By: Mátyás Horváth