如何在没有 pip/easy_install 的情况下手动安装 pypi 模块? [英] How to manually install a pypi module without pip/easy_install?

查看:31
本文介绍了如何在没有 pip/easy_install 的情况下手动安装 pypi 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 gntp 模块来为 C/C++ 软件显示类似烤面包机的通知.我想打包软件的所有依赖项,以便在另一台计算机上自动执行.

I want to use the gntp module to display toaster-like notifications for a C/C++ software. I want to package all the dependencies for the soft to be self-executable on a another computer.

gntp 模块只能通过 pip 安装程序使用,无法使用(运行该软件的计算机没有任何互联网连接):我如何从源头安装它?

The gntp module is only available through the pip installer, which cannot be used (The computer which is running the soft do not have any internet connection) : how can I install it from the sources ?

我不想强迫用户安装 easy_install/pip 并手动将 pip 路径添加到 %PATH.

I would prefer not to force the user to install easy_install/pip and manually add the pip path to the %PATH.

PS:我在 Windows 机器上使用 Python 2.7.

PS : I'm using Python 2.7 on a Windows machine.

推荐答案

  1. 下载软件包
  2. 如果已压缩,请解压缩
  3. cd 进入包含 setup.py 的目录
  4. 如果此处包含的文档中包含任何安装说明,请阅读并按照说明进行操作否则
  5. 输入python setup.py install

您可能需要管理员权限才能执行第 5 步.因此,您在此处执行的操作取决于您的操作系统.例如在 Ubuntu 中你会说 sudo python setup.py install

You may need administrator privileges for step 5. What you do here thus depends on your operating system. For example in Ubuntu you would say sudo python setup.py install

编辑-感谢 kwatford(见第一条评论)

EDIT- thanks to kwatford (see first comment)

要在上述第 5 步中绕过对管理员权限的需求,您可以使用 --user 标志.这样你就可以只为当前用户安装包.

To bypass the need for administrator privileges during step 5 above you may be able to make use of the --user flag. In this way you can install the package only for the current user.

文档说:

文件将被安装到site.USER_BASE的子目录中(以下写为userbase).此方案将纯 Python 模块和扩展模块安装在同一位置(也称为 site.USER_SITE).以下是 UNIX(包括 Mac OS X)的值:

Files will be installed into subdirectories of site.USER_BASE (written as userbase hereafter). This scheme installs pure Python modules and extension modules in the same location (also known as site.USER_SITE). Here are the values for UNIX, including Mac OS X:

可以在此处找到更多详细信息:http://docs.python.org/2.7/install/index.html

More details can be found here: http://docs.python.org/2.7/install/index.html

这篇关于如何在没有 pip/easy_install 的情况下手动安装 pypi 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆