如何在没有ROOT ACCESS的情况下安装python模块YAML('easy_install'和'pip'不可用)? [英] How can I install the python module YAML without ROOT ACCESS ( 'easy_install' and 'pip' are not available)?

查看:150
本文介绍了如何在没有ROOT ACCESS的情况下安装python模块YAML('easy_install'和'pip'不可用)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在服务器上运行一个调用 yaml模块的python脚本.我仅在主目录中具有写权限.该服务器已安装Python 2.7.3.我没有root访问权限.另外, pip easy_install 都不可用.

I am trying to run a python script that calls the yaml module on a server. I only have writing permissions in my home directory. The server has Python 2.7.3 installed. I do not have root access. Also, neither pip nor easy_install are available.

我已经下载了软件包并尝试运行

I have downloaded the package and tried to run

python setup.py install --user

出现错误

error: can't combine user with with prefix/exec_prefix/home or install_(plat)base

如何使它正常工作?

推荐答案

基于安东(Anton)的答案,这些步骤对我有用

Based on the idea of the answer by Anton, these steps worked for me

pip install --user ruamel.yaml

然后替换您的脚本

import yaml

具有:

from ruamel.yaml import YAML
yaml=YAML(typ='safe')

这篇关于如何在没有ROOT ACCESS的情况下安装python模块YAML('easy_install'和'pip'不可用)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆