【问题标题】:centOS 7 - difficulties with installing Python 3centOS 7 - 安装 Python 3 的困难
【发布时间】:2017-04-05 17:32:38
【问题描述】:

我有一个全新的 centOS 7 虚拟机,正在尝试安装 Python 3(当前为 3.6.0)。我正在遵循 Daniel Eriksson (https://danieleriksson.net/2017/02/08/how-to-install-latest-python-on-centos/) 的指南

但是我在运行make && make altinstall 命令时遇到了Pemission denied 错误。

我得到的错误的最后一部分在这里:

gcc -pthread -c -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes    -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers   -I. -I./Include   -fPIC -DPy_BUILD_CORE -o Programs/_testembed.o ./Programs/_testembed.c
gcc -pthread -Wl,-rpath /usr/local/lib  -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o -L. -lpython3.6m -lpthread -ldl  -lutil   -lm  
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,/usr/local/bin/python3.6m," < ./Misc/python-config.in >python-config.py
# Replace makefile compat. variable references with shell script compat. ones;  -> 
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
    cp python-config.py python-config; \
fi
if test "no-framework" = "no-framework" ; then \
    /bin/install -c python /usr/local/bin/python3.6m; \
else \
    /bin/install -c -s Mac/pythonw /usr/local/bin/python3.6m; \
fi
/bin/install: cannot create regular file ‘/usr/local/bin/python3.6m’: Permission denied
make: *** [altbininstall] Error 1

我通常不使用 Linux,所以我不确定在哪里寻找或接下来要尝试什么。对此的任何帮助表示赞赏。谢谢

【问题讨论】:

  • 你需要root或者需要sudoers权限
  • 我用sudo make &amp;&amp; make altinstall - 这不是你的意思吗?
  • @mmenschig :使用sudo make &amp;&amp; sudo make altinstall
  • @SantoshA 我在写评论时想知道我是否应该这样做......该死的Linux......我会试试这个!
  • @SantoshA 成功了!谢谢,我的朋友。我现在应该回答我自己的问题吗?

标签: python linux centos


【解决方案1】:

问题在于运行命令安装包时所需的权限。

使用
sudo make &amp;&amp; sudo make altinstall

而不是:
sudo make &amp;&amp; make altinstall

【讨论】:

  • 在您的.spec 文件中?我以为它会以 root 身份安装,并且在 RPM 构建期间会 chroot 吗?
猜你喜欢
  • 1970-01-01
  • 2022-01-04
  • 1970-01-01
  • 2020-04-14
  • 2011-02-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-17
相关资源
最近更新 更多