简体   繁体   English

安装没有 pip/easy_install 或“python setup.py install”的模块

[英]install a module without pip/easy_install or “python setup.py install”

I am trying to install the ptyprocess module: https://github.com/pexpect/ptyprocess .我正在尝试安装 ptyprocess 模块: https://github.com/pexpect/ptyprocess

I cannot do a "pip install ptyprocess" as my pip is blocked by ssl issues on the server.我无法执行“pip install ptyprocess”,因为我的 pip 被服务器上的 ssl 问题阻止。

Also, I cannot clone the above repository and run a "python setup.py install" since there is no setup.py in the repository;此外,我无法克隆上述存储库并运行“python setup.py install”,因为存储库中没有 setup.py; instead there is a pyproject.toml which requires "pip install pyproject.yoml", but again, this is reliant on pip which is blocked.相反,有一个 pyproject.toml 需要“pip install pyproject.yoml”,但同样,这依赖于被阻止的 pip。

How then can I install this module?那么我该如何安装这个模块呢?

ps I've installed other modules on my server via github, but they have the desired "setup.py" and not "pyproject.toml", therefore I was able to run "python setup.py install" successfully. ps 我已经通过 github 在我的服务器上安装了其他模块,但是它们具有所需的“setup.py”而不是“pyproject.toml”,因此我能够成功运行“python setup.py install”。

To install a module copy the pytprocess folder (or whatever folder contains the topmost __init__.py ) to your site-packages (usually in {python location}\lib\site-packages ) directory.要安装模块, pytprocess文件夹(或包含最顶层__init__.py的任何文件夹)复制到您的site-packages (通常位于{python location}\lib\site-packages )目录中。 You may still need to manually install the dependencies, (in this case flit ) as well.您可能还需要手动安装依赖项(在本例中为flit )。 Note this only works if the package is pure python.请注意,这只适用于 package 是纯 python 的情况。

my pip is blocked by ssl issues on the server我的 pip 被服务器上的 ssl 问题阻止

your actual question put aside, you should also fix this issue抛开你的实际问题,你也应该解决这个问题


Coming to your question, if the package you are trying to install is on PyPi (where pip usually looks for packages), then you always have the option to manually download it first from the files section of the projects page and then install it.谈到您的问题,如果您尝试安装的 package 位于 PyPi 上( pip通常会在其中查找软件包),那么您始终可以选择先从项目页面的文件部分手动下载然后安装它。 In this case, there are two files available:在这种情况下,有两个文件可用:

  1. ptyprocess-0.6.0-py2.py3-none-any.whl - This is a whl file, which is a pre-packed file created by setuptools. ptyprocess-0.6.0-py2.py3-none-any.whl - 这是一个 whl 文件,它是由 setuptools 创建的预打包文件。 It is compatible with both python2 and 3 versions and has no OS restrictions ("any").它与 python2 和 3 版本兼容,并且没有操作系统限制(“任何”)。 Once downloaded you can install using pip install ptyprocess-0.6.0-py2.py3-none-any.whl下载后,您可以使用pip install ptyprocess-0.6.0-py2.py3-none-any.whl
  2. ptyprocess-0.6.0.tar.gz This is the source code, it can be installed using pip install ptyprocess-0.6.0.tar.gz . ptyprocess-0.6.0.tar.gz这是源代码,可以使用pip install ptyprocess-0.6.0.tar.gz

This solution is of course specific to packages that are available on PyPi as a workaround if pip cannot download and install the project itself.如果pip无法下载和安装项目本身,此解决方案当然特定于 PyPi 上可用的包作为解决方法。 It also works to pip install on offline machines if you just download the neccessary files on a second machine and then copy them over它也适用于pip install在离线机器上,如果您只是在第二台机器上下载必要的文件然后将它们复制过来

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

相关问题 带有setup.py/easy_install的ModuleNotFoundError,但是pip有效 - ModuleNotFoundError with setup.py/easy_install, but pip works 我可以使用`pip`而不是`easy_install`来进行`python setup.py install`依赖解析吗? - Can I use `pip` instead of `easy_install` for `python setup.py install` dependency resolution? 使用easy_install或setup.py install在OSX上安装Python模块 - Installing Python modules on OSX using easy_install or setup.py install setup.py 中的 SyntaxError with pip to install module - SyntaxError in setup.py with pip to install module 如何在没有 pip/easy_install 的情况下手动安装 pypi 模块? - How to manually install a pypi module without pip/easy_install? 在 python setup.py sdist 之前运行 easy_install 和 / - Running easy_install along with / before python setup.py sdist PIP安装没有setup.py文件的Python包? - PIP install a Python Package without a setup.py file? 如何安装没有root,pip,setuptools或easy_install的Python模块 - How to install a Python module without root, pip, setuptools, or easy_install 如何在没有ROOT ACCESS的情况下安装python模块YAML('easy_install'和'pip'不可用)? - How can I install the python module YAML without ROOT ACCESS ( 'easy_install' and 'pip' are not available)? 在没有Pip或setup.py的Ubuntu 16.04上安装Python模块easygui - Install Python module easygui on Ubuntu 16.04 without Pip or setup.py
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM