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

查看:138
本文介绍了如何在没有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.

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

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
  1. Download the package
  2. unzip it if it is zipped
  3. cd into the directory containing setup.py
  4. If there are any installation instructions contained in documentation contianed herein, read and follow the instructions OTHERWISE
  5. type in 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天全站免登陆