简体   繁体   English

使用setup.py安装软件包时不会创建Pyenv填充程序

[英]Pyenv shim not created when installing package using setup.py

When I install a package into a pyenv environment by using ./setup.py install , the package's script is not added to pyenv's shim directory. 当我使用./setup.py install将软件包./setup.py install到pyenv环境中时,软件包的脚本不会添加到pyenv的shim目录中。 As a result, the script is not in my PATH and cannot be executed normally. 因此,脚本不在我的PATH中,无法正常执行。

My package is using setuptools. 我的包正在使用setuptools。 My package's setup.py specifies a script that should be installed. 我的包的setup.py指定了应该安装的脚本。

SCRIPTS = [
    'bin/olio_msg_send_test_messages',
]
setup(
    ...
    scripts=SCRIPTS,
    ...
)

When I install the package using: 当我使用以下命令安装包时:

./setup.py build
./setup.py install

Then the script gets installed into the package's directory: 然后脚本安装到包的目录中:

...
Installing olio_msg_send_test_messages script to /home/wayne/.pyenv/versions/2.6.9/bin
...

And the file is indeed there: 文件确实存在:

$ ls -l /home/wayne/.pyenv/versions/2.6.9/bin/olio_msg_send_test_messages 
-rwxrwxr-x 1 wayne wayne 240 Apr 20 09:30 /home/wayne/.pyenv/versions/2.6.9/bin/olio_msg_send_test_messages

However, no shim is added to pyenv 's shims directory: 但是, pyenv的shims目录中没有添加任何填充程序:

$ ls -l ~/.pyenv/shims/olio_msg_send_test_messages 
ls: cannot access /home/wayne/.pyenv/shims/olio_msg_send_test_messages: No such file or directory

Therefore the script is not in my PATH and cannot be executed by typing its name. 因此,脚本不在我的PATH中,并且无法通过键入其名称来执行。

What do I need to do so that the pyenv shim gets created when I install the package via ./setup.py install ? 当我通过./setup.py install安装软件包时,我需要做什么才能创建pyenv shim?


Versions: 版本:

  • pyenv 20141118 pyenv 20141118
  • python 2.6.7 python 2.6.7

Versions of pyenv before v20141211 do not automatically "rehash" (that is, update shims) when a new package is installed. 安装新软件包时,v20141211之前的pyenv版本不会自动“重新散列”(即更新填充程序)。 To get pyenv to automatically rehash, either upgrade to a newer version of pyenv, or install the pyenv-pip-refresh plugin. 要让pyenv自动重新散列,请升级到更新版本的pyenv,或者安装pyenv-pip-refresh插件。

To rehash manually, use this command for bash : 要手动重新散列,请将此命令用于bash

pyenv rehash && hash -r

or this command for zsh : 或者zsh这个命令:

pyenv rehash && rehash

(The rehash instructions are from yyuu in a reply to this github issue ) (重复说明来自yyuu回复此github问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM