gpt4 book ai didi

python - 如何在没有 root 访问权限的情况下从 Github 安装 python 模块?

转载 作者:太空宇宙 更新时间:2023-11-04 00:48:39 25 4
gpt4 key购买 nike

我已经阅读了几篇文章,但我没有运气,因为我的情况与其他人拥有的一项或多项自由相冲突。这是我的情况。

  • 我无权访问 root
  • 我只是一个可以访问 python 的用户。没有 sudo
  • python 2.x.x 已预装
  • pip 未预安装。
  • apt-get 需要 root特权。

我的目标是安装一个名为 Guessit 的简单模块来自 Github,用于我的 foo.py 项目。它的安装由 pip 给出,因此排除了该选项。我尝试按照 https://github.com/guessit-io/guessit/blob/master/docs/sources.rst 手动安装.我下载了 zip 文件,解压并运行

python setup.py install

它给了我以下错误

Traceback (most recent call last):
File "setup.py", line 4, in <module>
from setuptools import setup, find_packages
ImportError: No module named setuptool

所以,此时我认为我需要 setuptools 模块,因此下载了 https://bootstrap.pypa.io/ez_setup.py并尝试按照 https://pypi.python.org/pypi/setuptools 安装它通过运行

wget https://bootstrap.pypa.io/ez_setup.py -O - | python

再次失败,出现如下错误:

Downloading https://pypi.io/packages/source/s/setuptools/setuptools-24.0.0.zip
Extracting in /tmp/tmplNW7fe
Now working in /tmp/tmplNW7fe/setuptools-24.0.0
Installing Setuptools
Traceback (most recent call last):
File "setup.py", line 21, in <module>
exec(init_file.read(), command_ns)
File "<string>", line 11, in <module>
File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/__init__.py", line 14, in <module>
from setuptools.extension import Extension
File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/extension.py", line 11, in <module>
from . import msvc
File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/msvc.py", line 244, in <module>
class PlatformInfo:
File "/tmp/tmplNW7fe/setuptools-24.0.0/setuptools/msvc.py", line 253, in PlatformInfo
current_cpu = safe_env['processor_architecture'].lower()
File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
raise KeyError(key)
KeyError: 'processor_architecture'
Something went wrong during the installation.
See the error message above.

现在,我猜测该设置的架构与我的机器存在匹配问题。

在这一 pip 上,我什至不确定我所做的是否正确。不管它的值(value)如何,这是我使用 uname -a

的计算机架构
Linux sl04.cmi.ac.in 3.13.0-85-generic #129-Ubuntu SMP Thu Mar 17 20:50:41 UTC 2016 i686 i686 i686 GNU/Linux

如有任何帮助,我们将不胜感激!

最佳答案

setuptools 24.0.0(今天发布)中存在问题。我想它很快就会修好。同时,降级到 23.1 并重新安装所需的包。

关于python - 如何在没有 root 访问权限的情况下从 Github 安装 python 模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38163864/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com