如何在不使用pip install的情况下从tar.gz文件安装Python软件包

问题描述:

长话短说,我的工作计算机受到网络限制,这意味着尝试在cmd中使用pip install只会导致超时/找不到包错误.

Long story short my work computer has network constraints which means trying to use pip install in cmd just leads to timing out/not finding package errors.

例如;当我尝试pip install seaborn时:

For example; when I try to pip install seaborn:

相反,我尝试下载我想要的软件包的tar.gz文件,但是,我不知道如何安装它们.我已经从tar.gz文件中提取了文件,并且里面有一个设置"文件,但是对我来说并没有多大作用.

Instead I have tried to download the tar.gz file of the packages I want, however, I do not know how to install them. I've extracted the files from the tar.gz file and there is a "setup" file within but it's not doing much for me.

如果有人可以解释如何以这种方式安装python软件包而无需在Windows上使用pip install的话,那就太棒了.

If someone could explain how to install python packages in this manner without using pip install on windows that would be amazing.

多亏了以下答案,我已经开始使用它了.

Thanks to the answers below combined I've got it working.

  • 首先需要将tar.gz文件解压缩到一个文件夹中.
  • 然后在运行python setup.py install之前必须将cmd指向正确的文件夹.我是通过pushd C:\Users\absolutefilepathtotarunpackedfolder
  • 完成的
  • 然后运行python setup.py install
  • First needed to unpack the tar.gz file into a folder.
  • Then before running python setup.py install had to point cmd towards the correct folder. I did this by pushd C:\Users\absolutefilepathtotarunpackedfolder
  • Then run python setup.py install

感谢传说帕多瓦&雨果·霍诺姆

Thanks Tales Padua & Hugo Honorem