简体   繁体   English

pip 如何在同时拥有 64 位和 32 位版本的同时安装 64 位软件包?

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

I have decided to learn generic algorithms recently and I needed to install Tensorflow package.我最近决定学习通用算法,我需要安装 Tensorflow package。 Tensorflow run on python 64 bit only, so i install python 3.5.0 64 bit without uninstalling python 32 bit. Tensorflow 仅在 python 64 位上运行,所以我安装 python 3.5.0 64 位而不卸载 Z23EEEB237bitEE.BDD26BDDZ66 because i was afraid to lose my packages on python 32 bit by uninstalling it.因为我害怕通过卸载它而丢失 python 32 位上的包。 The problem is how can i force pip install to install a package on my python 64 bit version instead of 32 bit version.问题是我如何强制pip 安装在我的 python 64 位版本而不是 32 位版本上安装 package。

If you have actually managed to install both x64 & x32 packages, you could simply do如果您确实设法安装了 x64 和 x32 软件包,则可以简单地执行

C:\path\to\corresponding\python.exe -m pip install <package>

This will ensure you use the correct pip and install the package for the specific python instance.这将确保您使用正确的pip并为特定的 python 实例安装包。

Starting with Python 3.3, coexistence is made much easier with the Python Launcher for Windows .从 Python 3.3 开始,Python Launcher for Windows使共存变得更加容易。 (Also see PEP 397.) From the command line you can use "py" or "pyw" in place of "python" or "pythonw". (另请参阅 PEP 397。)在命令行中,您可以使用“py”或“pyw”代替“python”或“pythonw”。 The py command allows you to specify the revision and version of python to run. py 命令允许您指定要运行的python 的修订版和版本。 For example, open a command window and type in "py -3".例如,打开一个命令窗口并输入“py -3”。 This runs the latest revision of python 3 available and defaults to the 64 bit version if it is available.这将运行最新版本的 python 3,如果可用,则默认为 64 位版本。 On the original poster's system, entering this command will start the python 3.5-64 bit interpreter.在原始发布者的系统上,输入此命令将启动 python 3.5-64 位解释器。

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.此命令还可用于运行正确版本的 pip,而无需知道要安装到的 Python 版本的确切路径。 "py -3.5 -m pip install [package]" will install [package] to the 64 bit version of python3.5. “py -3.5 -m pip install [package]”将安装[package]到64位版本的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.如果您同时安装了 64 位和 32 位版本,并且需要安装到 32 位版本,则必须在命令中输入主要和次要修订号,并将“-32”添加到命令参数中。 "py -3.5-32 -m pip install [package]" will install to the 32 bit version. “py -3.5-32 -m pip install [package]”将安装到 32 位版本。

I have both 64 and 32 bit python environments on my machine.我的机器上有 64 位和 32 位 python 环境。

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.要构建面向 32 位或 64 位的目标,我编辑了环境变量,为整个 python 安装设置了 PATH,并有一个环境变量指向 pyinstaller 所在的脚本区域。

.....\Continuum\anaconda3_32bit
.....\Continuum\anaconda3_32bit\Scripts
 or 
.....\Continuum\anaconda3
.....\Continuum\anaconda3\Scripts

The I run pip install pyinstaller (which uses the PATH to find the required versions of PIP and pyinstaller).我运行 pip install pyinstaller(它使用 PATH 来查找所需的 PIP 和 pyinstaller 版本)。

The app must have been built using the correct python environment as well.该应用程序也必须是使用正确的 Python 环境构建的。

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, eg install bitcoin lib:如果您同时安装了 64 位和 32 位版本,并且只需要安装 32 位版本 package,则必须使用 pip3 输入目标 -t(32 位库),例如安装比特币库:

 pip3 install -t C:\Users\
       max\AppData\Local\Programs\Python\Python36-32\Lib bitcoin

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.作为一个额外的解决方案,很高兴知道 windows(或任何)操作系统首先在当前目录中查找应用程序,然后检查路径环境变量。 So it's a good idea to place preferred python version's path to first position in path env variable.因此,将首选 python 版本的路径放置到第一个 position路径环境变量中是个好主意。 Or simply replace the old pythons's path with new one.或者干脆用新的替换旧蟒蛇的路径。

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.最好的办法是更改您的 python 路径并在 64 位 python 上安装软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何同时在32位和64位版本中通过pipenv在虚拟环境(.virtualenvs)中安装64位软件包? - how to pipenv install 64 bit packages in virtual environement (.virtualenvs) while having both 32 bit and 64 bit versions? 如何让 pip install 将软件包安装到 64 位版本,而不是 32 位版本? - How to get pip install to install packages into the 64bit version ,not 32bit one? Windows Python 64和32位版本和点子 - Windows Python 64 & 32 bit versions and pip python pip 安装仅适用于 64 位而非 32 位 - python pip install is working only for 64 bit and not 32 bit 如何在32位环境下下载64位pip程序包 - How to download 64-bit pip packages under 32-bit environment 如何在Red Hat Linux 64位上安装python 32位 - How To install python 32 bit on Red Hat Linux 64 bit Python win32com-同时安装32位和64位版本的应用程序 - Python win32com - application installed with both 32bit and 64bit versions Python 32位到64位? - Python 32 bit to 64 bit? 假电脑架构(64位而不是32位) - pip with fake computer architecture (64 bit instead 32 bit) 在 Windows 上 PIP 安装 MySQL-python 在 Python 64 位中失败,但如果使用 32 位则成功 - PIP install MySQL-python on Windows fails in Python 64bit but succeeds if use 32bit
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM