简体   繁体   English

如何使用Windows版pip在不同的python安装中安装模块

[英]How to install modules in different python installations using pip for Windows

I'm trying to create a standalone executable with PyInstaller. 我正在尝试使用PyInstaller创建一个独立的可执行文件。 I currently have Python 3.4 which is not supported by PyInstaller. 我目前有PyInstaller不支持的Python 3.4。 I downloaded Python 2.7 but now I am not able to install PyInstaller with pip. 我下载了Python 2.7,但现在无法使用pip安装PyInstaller。 I set the path variable to C:/Python24 but I still get this message when I type python pip into the command console. 我将路径变量设置为C:/ Python24,但是当我在命令控制台中键入python pip时仍然收到此消息。

Requirement already up-to-date: pip in c:\\python34.... 要求已经是最新的:c:\\ python34 ....中的pip

When I use the commands: 当我使用命令时:

echo %PATH% 
python pip.py 

I get the output: 我得到的输出:

c:\\mingw\\bin;C:\\Program Files\\Java\\jdk1.7.0_25\\bin;c:\\windows\\system32;c:\\Python34;C:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit\\;C:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn\\;C:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0\\;C:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn\\;C:\\Ruby193\\bin;C:\\Program Files\\Java\\jdk1.8.0_05\\bin;C:\\Python27;C:\\Python27\\Scripts;C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC c:\\ mingw \\ bin; C:\\ Program Files \\ Java \\ jdk1.7.0_25 \\ bin; c:\\ windows \\ system32; c:\\ Python34; C:\\ Program Files(x86)\\ ATI Technologies \\ ATI.ACE \\静态静态; C:\\ Program Files(x86)\\ Windows Kits \\ 8.1 \\ Windows Performance Toolkit \\; C:\\ Program Files \\ Microsoft SQL Server \\ 110 \\ Tools \\ Binn \\; C:\\ Program Files(x86)\\ Microsoft SDKs \\ TypeScript \\ 1.0 \\; C:\\ Program Files \\ Microsoft SQL Server \\ 120 \\ Tools \\ Binn \\; C:\\ Ruby193 \\ bin; C:\\ Program Files \\ Java \\ jdk1.8.0_05 \\ bin; C:\\ Python27 ; C:\\ Python27 \\ Scripts; C:\\ Program Files(x86)\\ Microsoft Visual Studio 10.0 \\ VC

Requirement already up-to-date: pip in c:\\python34\\lib\\site-packages 要求已经是最新的:c:\\ python34 \\ lib \\ site-packages中的pip

Cleaning up... 打扫干净...

To install pip for Python 2.7 run the get-pip.py (you can get it here for example) script using Python 2.7 interpreter: 要为Python 2.7安装pip,请使用Python 2.7解释器运行get-pip.py(例如, 在此处获取它)脚本:

> C:\\Python27\\python.exe get-pip.py > C:\\ Python27 \\ python.exe get-pip.py

Downloading/unpacking pip 下载/解包点

Installing collected packages: pip 安装收集的软件包:pip

Successfully installed pip 已成功安装pip

Cleaning up... 打扫干净...

> C:\\Python27\\Scripts>c:\\Python27\\Scripts\\pip.exe > C:\\ Python27 \\ Scripts> c:\\ Python27 \\ Scripts \\ pip.exe

Usage: 用法:

pip <command> [options] pip <命令> [选项]

[...] [...]

To run scripts from a particular Python distribution go to their directory in the console: 要从特定的Python发行版运行脚本,请在控制台中转到其目录:

Typically: 典型:

> C: > C:

C:\\......\\ C:\\......\\

> cd \\Python27\\Scripts > cd \\ Python27 \\脚本

C:\\Python27\\Scripts C:\\ Python27 \\ Scripts中

> pip or easy_install or whatever > pip或easy_install或其他

If you want to have it in PATH, then the Scripts subdirectory is the one to add, not just Python's root directory. 如果要在PATH中使用它,则可以添加Scripts子目录,而不仅仅是Python的根目录。 Also be sure to remove any other occurrences of Python paths in this variable (in both system and user PATH settings). 此外,一定要除去的Python的路径的任何其他出现在这个变量(在系统和用户PATH设置)。

Alternatively, you can just download the package directly (eg for PyInstaller: https://pypi.python.org/pypi/PyInstaller/2.1 ). 或者,您可以直接下载该软件包(例如,用于PyInstaller: https ://pypi.python.org/pypi/PyInstaller/2.1)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM