Python 3:安装自己的软件包和第三方软件包的好位置? [英] Python 3: Good location(s) to install own and 3rd party packages?
问题描述
对于Python 3.x:
我想要有关最佳目录的建议,在该目录中可以找到要在多个项目中使用的模块(以及所有相关因素).我知道import语句和PYTHONPATH,以及使任何位置起作用"的各种方法,但是我希望与标准做法保持一致.
所以:
-
我应该将模块放入"Pythonxx \ Lib \ site-packages"中的软件包中吗?
-
site-packages目录是否受到特殊待遇,或者与其他可能的模块位置没有区别?我对它是否具有特殊的".pth"和/或
__init__.py
行为感到困惑. -
约定在多大程度上受distutils的影响,这似乎并没有为Python 3做好准备……这是否意味着我应该参加其他一些约定? p>
-
我应该怎么做: http://docs.python. org/py3k/install/index.html 中的安装方式"似乎(在表中)声称"site-packages"与Windows不相关,尽管我在其中看到一个空的site-packages目录我的Windows Python 3.1安装.
-谢谢!
-
是的-但让您的setup.py来做
-
否
-
您为什么认为有问题?
-
文档需要修复.默认的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:
Should I be putting my modules in a package in "Pythonxx\Lib\site-packages"?
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.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?
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!
Yes -- but let your setup.py do it
No
Why do you think there is a problem?
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屋!