Linux 上的 Python 路径

编程入门 行业动态 更新时间:2024-10-28 15:21:00
本文介绍了Linux 上的 Python 路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是这方面的新手,我已经开始学习 Python,但我有一些我无法理解的问题,

I'm novice in this, and I have started learning Python, but I have some questions that I'm not be able to understand,

  • PYTHONPATH(在 Ubuntu 上)究竟是什么?是文件夹吗?
  • Ubuntu 是否默认提供 Python,还是必须明确安装?
  • 所有模块所在的文件夹在哪里(我有很多名为 python_ 的文件夹)?
  • 如果我希望在编程时使用一个新模块(例如 pyopengl),我应该去哪里引入我在下载的文件夹中获得的所有文件夹?
  • 从 PYTHONPATH 问题回来,我该如何配置 PYTHONPATH 以开始处理我的新模块?
  • 推荐答案

  • PYTHONPATH 是一个环境变量
  • 是(见 unix.stackexchange/questions/24802/on-which-unix-distributions-is-python-installed-as-part-of-the-default-install)
  • /usr/lib/python2.7 在 Ubuntu 上
  • 您不应手动安装软件包.相反,请使用 pip.当一个包不在 pip 中时,它通常有一个 setuptools 安装脚本来安装包到正确的位置(见第 3 点).
  • 如果您使用 pip 或 setuptools,则不需要显式设置 PYTHONPATH
  • PYTHONPATH is an environment variable
  • Yes (see unix.stackexchange/questions/24802/on-which-unix-distributions-is-python-installed-as-part-of-the-default-install)
  • /usr/lib/python2.7 on Ubuntu
  • you shouldn't install packages manually. Instead, use pip. When a package isn't in pip, it usually has a setuptools setup script which will install the package into the proper location (see point 3).
  • if you use pip or setuptools, then you don't need to set PYTHONPATH explicitly
  • 如果您查看 pyopengl 的说明,您会发现它们是与第 4 点和第 5 点一致.

    If you look at the instructions for pyopengl, you'll see that they are consistent with points 4 and 5.

    更多推荐

    Linux 上的 Python 路径

    本文发布于:2023-07-27 00:30:44,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1219244.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:路径   Linux   Python

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!