Python 使用 pip 安装下载的 tar.gz 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/43419975/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 23:02:27  来源:igfitidea点击:

Installing downloaded tar.gz files with pip

pythonpippygui

提问by Shane

When I download PyGUI-2.5.4.tar.gzfrom http://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/and then run

当我PyGUI-2.5.4.tar.gzhttp://www.cosc.canterbury.ac.nz/greg.ewing/python_gui/下载然后运行

pip install downloads/PyGUI-2.5.4.tar.gz

I get a long error, the root of which appears to be the following:

我收到一个很长的错误,其根源似乎如下:

tarfile.ReadError: not a gzip file

Any ideas what I'm doing wrong?

任何想法我做错了什么?

采纳答案by A H M Forhadul Islam

You can install tar.gz with pip Install a particular source archive file.

您可以使用 pip 安装 tar.gz 安装特定的源存档文件。

pip install ./Package-1.0.4.tar.gz

You can also install it with extracting tar.gz file. First you should extract it using using tar command.

您也可以通过解压缩 tar.gz 文件来安装它。首先,您应该使用 tar 命令提取它。

tar -xzvf PyGUI-2.5.4.tar.gz
cd PyGUI-2.5.4.tar.gz

And then use the setup.py file to install the package .

然后使用 setup.py 文件安装包。

python setup.py install

or

或者

sudo python setup.py install

( use sudo only in linux )

(仅在 linux 中使用 sudo )

Source: https://pip.readthedocs.io/en/stable/reference/pip_install/#git

来源:https: //pip.readthedocs.io/en/stable/reference/pip_install/#git

回答by Akash Agrawal

The correct syntax for the installation is:

安装的正确语法是:

pip install --user ./Downloads/PyGUI-2.5.4.tar.gz

The --useris used to give the necessary permissions to install the package. Always check for the correct path and Upper and Lower case in your path(Your path was to 'downloads' with small 'd' ).

--user是用来给安装包所需的权限。始终检查路径中的正确路径和大小写(您的路径是“下载”,带有小 'd' )。