Python 3:安装自己的软件包和第三方软件包的好位置? [英] Python 3: Good location(s) to install own and 3rd party packages?

查看:105
本文介绍了Python 3:安装自己的软件包和第三方软件包的好位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于Python 3.x:

我想要有关最佳目录的建议,在该目录中可以找到要在多个项目中使用的模块(以及所有相关因素).我知道import语句和PYTHONPATH,以及使任何位置起作用"的各种方法,但是我希望与标准做法保持一致.

所以:

  1. 我应该将模块放入"Pythonxx \ Lib \ site-packages"中的软件包中吗?

  2. site-packages目录是否受到特殊待遇,或者与其他可能的模块位置没有区别?我对它是否具有特殊的".pth"和/或__init__.py行为感到困惑.

  3. 约定在多大程度上受distutils的影响,这似乎并没有为Python 3做好准备……这是否意味着我应该参加其他一些约定? p>

  4. 我应该怎么做: http://docs.python. org/py3k/install/index.html 中的安装方式"似乎(在表中)声称"site-packages"与Windows不相关,尽管我在其中看到一个空的site-packages目录我的Windows Python 3.1安装.

-谢谢!

解决方案

  1. 是的-但让您的s​​etup.py来做

  2. 您为什么认为有问题?

  3. 文档需要修复.默认的Python安装目录为C:\ PythonXY,而不是C:\ Python.默认的软件包安装目录为C:\ PythonXY \ Lib \ site-packages.

For Python 3.x:

I'd like advice on best directory in which to locate modules that I want to use across multiple projects (and any related factors). I know about the import statement and PYTHONPATH, and various ways to make any location "work", but I want to be in line with standard practice.

So:

  1. Should I be putting my modules in a package in "Pythonxx\Lib\site-packages"?

  2. Does the site-packages directory get special treatment, or is it no different than other possible locations for modules? I'm confused as to whether it has special ".pth" and/or __init__.py behavior.

  3. To what extent are conventions influenced by what distutils does, which doesn't seem to be really ready for Python 3... and does that mean that I should be attending to some other conventions going forward?

  4. What should I make of this: http://docs.python.org/py3k/install/index.html in which "How installation works" seems to claim (in the table) that 'site-packages' is not relevant to Windows, though I see an empty site-packages directory in my Windows Python 3.1 installation.

-- Thanks!

解决方案

  1. Yes -- but let your setup.py do it

  2. No

  3. Why do you think there is a problem?

  4. The docs need fixing. The default Python install directory is C:\PythonXY, not C:\Python. The default package install directory is C:\PythonXY\Lib\site-packages.

这篇关于Python 3:安装自己的软件包和第三方软件包的好位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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