[英]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:在这种情况下,有两个文件可用:
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
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.