《python》在用户包下安装库出现权限报错

错误:

  WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script coloredlogs is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script randomname is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script pykwalify is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script markdown_py is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script jsonschema is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script dask is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script doesitcache is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script google-oauthlib-tool is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script tensorboard is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The scripts estimator_ckpt_converter, import_pb_to_tensorboard, saved_model_cli, tensorboard, tf_upgrade_v2, tflite_convert, toco and toco_from_protos are installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script rasa is installed in '/home/lianlu/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
onnx-graphsurgeon 0.3.12 requires onnx, which is not installed.

问题原因:

这些警告信息表明您在Linux系统(特别是/home/lianlu用户目录下)使用pip安装了一些Python包,而这些包附带的可执行脚本安装到了/home/lianlu/.local/bin目录下。但是,您的系统PATH环境变量中没有包含这个目录,因此您不能直接在命令行通过这些脚本的名字来运行它们。

解决问题:

方法1:临时添加目录到PATH

每次打开终端时,如果需要使用这些脚本,可以手动将该目录添加到PATH中。可以在命令行中输入以下命令:

export PATH=$PATH:/home/lianlu/.local/bin

这样操作只会影响当前的终端会话。一旦关闭终端或打开新的终端窗口,就需要重新执行上述命令。

方法2:永久修改PATH环境变量

为了持久化这个设置,您可以将上述export命令添加到您的shell配置文件中。根据您使用的shell(通常是bash或者zsh),您需要编辑相应的配置文件。对于bash,通常是.bashrc.bash_profile;对于zsh,则是.zshrc

打开您的shell配置文件。例如,如果是bash,可以使用文本编辑器打开.bashrc

nano ~/.bashrc

在文件末尾添加以下行:

export PATH=$PATH:/home/lianlu/.local/bin

保存并关闭文件。

为了让改动生效,需要重新加载配置文件:

source ~/.bashrc

 或者如果是zsh,

source ~/.zshrc

这样设置后,每次打开终端时,/home/lianlu/.local/bin目录都会自动加入到PATH中,您就可以直接运行那些脚本了。

至于最后的错误信息,它指出pip的依赖解析器可能未考虑到所有已安装的包,导致依赖冲突。这可能是由于您安装的某个包与系统中其他地方安装的包版本不兼容。解决这种冲突通常需要确定具体冲突的包,然后可能需要卸载、更新或指定特定版本来重新安装相关的包。但首先确保PATH问题解决后,再尝试处理此依赖冲突,因为有时候环境变量设置不当也会间接导致这类错误信息出现。

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值