setuptools

Post-install script with Python setuptools

心已入冬 提交于 2019-11-26 05:49:12
问题 Is it possible to specify a post-install Python script file as part of the setuptools setup.py file so that a user can run the command: python setup.py install on a local project file archive, or pip install <name> for a PyPI project and the script will be run at the completion of the standard setuptools install? I am looking to perform post-install tasks that can be coded in a single Python script file (e.g. deliver a custom post-install message to the user, pull additional data files from a

What is the official “preferred” way to install pip and virtualenv systemwide?

十年热恋 提交于 2019-11-26 04:59:59
问题 Is it this, which people seem to recommend most often: $ sudo apt-get install python-setuptools $ sudo easy_install pip $ sudo pip install virtualenv Or this, which I got from http://www.pip-installer.org/en/latest/installing.html: $ curl -O https://github.com/pypa/virtualenv/raw/master/virtualenv.py $ python virtualenv.py my_new_env $ . my_new_env/bin/activate (my_new_env)$ pip install ... Or something entirely different? 回答1: If you can install the latest Python (2.7.9 and up) Pip is now

pip ignores dependency_links in setup.py

女生的网名这么多〃 提交于 2019-11-26 04:40:05
问题 I have dependency_links in my setup.py: ... dependency_links = [\'http://github.com/robot-republic/python-s3/tarball/master.tar.gz#egg=python-s3\'], ... But it doesn\'t work. However install_requires works fine. Maybe there are another method to set up git repo as required for setup.py? 回答1: This answer should help. In a nutshell, you need to specify the version (or "dev") for the #egg=python-s3 so it looks like #egg=python-s3-1.0.0 . Updates based on @Cerin's comment: Pip 1.5.x has a flag to

Explain Python entry points?

三世轮回 提交于 2019-11-26 03:29:01
问题 I\'ve read the documentation on egg entry points in Pylons and on the Peak pages, and I still don\'t really understand. Could someone explain them to me? 回答1: An "entry point" is typically a function (or other callable function-like object) that a developer or user of your Python package might want to use, though a non-callable object can be supplied as an entry point as well (as correctly pointed out in the comments!). The most popular kind of entry point is the console_scripts entry point,

How can I make setuptools install a package that&#39;s not on PyPI?

爱⌒轻易说出口 提交于 2019-11-26 02:16:14
问题 I\'ve just started working with setuptools and virtualenv. My package requires the latest python-gearman that is only available from GitHub. The python-gearman version that\'s on PyPI is an old one. The Github source is setuptools-compatible, i.e. has setup.py, etc. Is there a way to make setuptools download and install the new version instead of looking for it on PyPI and installing the old one? FYI, the new python-gearman is http://github.com/mtai/python-gearman 回答1: The key is to tell easy

How to include package data with setuptools/distribute?

房东的猫 提交于 2019-11-26 02:06:15
问题 When using setuptools/distribute, I can not get the installer to pull in any package_data files. Everything I\'ve read says that the following is the correct way to do it. Can someone please advise? setup( name=\'myapp\', packages=find_packages(), package_data={ \'myapp\': [\'data/*.txt\'], }, include_package_data=True, zip_safe=False, install_requires=[\'distribute\'], ) where myapp/data/ is the location of the data files. 回答1: I realize that this is an old question, but for people finding

Python setup.py develop vs install

徘徊边缘 提交于 2019-11-26 01:43:50
问题 Two options in setup.py develop and install are confusing me. According to this site, using develop creates a special link to site-packages directory. People have suggested that I use python setup.py install for a fresh installation and python setup.py develop after any changes have been made to the setup file. Can anyone shed some light on the usage of these commands? 回答1: python setup.py install is used to install (typically third party) packages that you're not going to develop/modify

What&#39;s the proper way to install pip, virtualenv, and distribute for Python?

喜欢而已 提交于 2019-11-26 01:34:28
问题 Short Question What is the proper way to install pip, virtualenv, and distribute? Background In my answer to SO question 4314376, I recommended using ez_setup so that you could then install pip and virtualenv as follows: curl -O http://peak.telecommunity.com/dist/ez_setup.py sudo python ez_setup.py sudo easy_install pip sudo pip install virtualenv I originally pulled these instructions from Jesse Noller\'s blog post So you want to use Python on the Mac?. I like the idea of keeping a clean

Differences between distribute, distutils, setuptools and distutils2?

陌路散爱 提交于 2019-11-26 01:27:55
问题 The Situation I’m trying to port an open-source library to Python 3. (SymPy, if anyone is wondering.) So, I need to run 2to3 automatically when building for Python 3. To do that, I need to use distribute . Therefore, I need to port the current system, which (according to the doctest) is distutils . The Problem Unfortunately, I’m not sure what’s the difference between these modules— distutils , distribute , setuptools . The documentation is sketchy as best, as they all seem to be a fork of one

No module named pkg_resources

匆匆过客 提交于 2019-11-26 01:24:05
问题 I\'m deploying a Django app to a dev server and am hitting this error when I run pip install -r requirements.txt : Traceback (most recent call last): File \"/var/www/mydir/virtualenvs/dev/bin/pip\", line 5, in <module> from pkg_resources import load_entry_point ImportError: No module named pkg_resources pkg_resources appears to be distributed with setuptools . Initially I thought this might not be installed to the Python in the virtualenv, so I installed setuptools 2.6 (same version as Python