小编Str*_*mer的帖子

如何使用setuptools生成一个调用`python -m mypackage`的console_scripts入口点?

我正在尝试成为一名优秀的Pythonista,并按照我的计划对PEP 338进行部署.

我也在尝试python setuptools install使用setuptools entry_points{'console_scripts': ... }选项生成可执行脚本.

如何使用entry_points生成一个调用的二进制文件python -m mypackage(并传递*args,**kwargs)?

以下是我做过的一些尝试但没有成功:

setuptools(
...
Run Code Online (Sandbox Code Playgroud)

(1)

entry_points=
       {'console_scripts': ['mypkg=mypkg.__main__'],},
Run Code Online (Sandbox Code Playgroud)

(2)

entry_points=
       {'console_scripts': ['mypkg=mypkg.main'],},
Run Code Online (Sandbox Code Playgroud)

(3)

entry_points=
       {'console_scripts': ['mypkg=python -m mypkg'],},
Run Code Online (Sandbox Code Playgroud)

我一直在使用的主要资源:

python deployment setuptools pep

18
推荐指数
1
解决办法
6692
查看次数

通过terminal命令使用浏览器自动重新加载html文件

我正在尝试做一些小的HTML网页内容,并且发现每当我保存文件时能够看到通过浏览器查看的html文件的实时更新非常有用.我知道可能有IDE为你做这个,如果你推荐任何,请做,但我想制作一个脚本,只需在浏览器中打开文件,同时关闭该文件的版本已打开,以便我可以继续在vim中完成所有编程.

我知道我可以在Mac OSX中使用以下内容,将文件打开到我当前浏览器的新选项卡中:

open foo.html
Run Code Online (Sandbox Code Playgroud)

但是,如果我在定时循环中发生这种情况,或者每次我在vim中编写(:w),我的浏览器都会填满新标签.有没有办法在打开新标签时关闭旧标签?或者有没有更好的方法,我没有考虑过?如果我可以继续在终端使用vim,那将是非常优选的.

提前致谢.

html unix macos bash terminal

7
推荐指数
2
解决办法
5908
查看次数

读取符号时gdb seg出错

尝试使用程序运行gdb时,它会在读取符号时出错.

当我跑:

gdb /home/user/path/to/program.exe

我明白了:

GNU gdb (Ubuntu 7.7-0ubuntu3.1) 7.7
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and …
Run Code Online (Sandbox Code Playgroud)

c++ memory debugging gdb

6
推荐指数
2
解决办法
3680
查看次数

如何找到在 dash 中来源的脚本的路径?

我试图让一个源 shell 脚本确定它自己的位置,我发现这对于 dash 来说是一项艰巨的任务。

在 bash、sh 和 csh 中,我可以使用:$_。

在鱼中,我可以使用(status -f).

总的来说,我没有运气......

我尝试获取如下所示的 path.sh 文件,结果如下:

# path.sh
called=$_
echo called:      $called
echo underscore:  $_
echo zero:        $0
echo dash_source: $DASH_SOURCE
echo bash_source: $BASH_SOURCE
Run Code Online (Sandbox Code Playgroud)

dash -c ". path.sh"

输出:

called:      /usr/local/bin/dash
underscore:  /usr/local/bin/dash
zero:        dash
dash_source:
bash_source:
Run Code Online (Sandbox Code Playgroud)

如何在破折号中获取path.sh的路径?

unix shell dash-shell

4
推荐指数
1
解决办法
2298
查看次数

为什么"N选择k"方法scipy.misc.comb(n,k)在Python2.x和Python3.x之间存在很大差异?

在项目Euler解决问题(剧透)中,这对我来说是一个问题:

15

Python2.7.10/0.13.0b1: scipy.misc.comb(40,20) -> array(137846528819.9994)

Python3.5.0/scipy 0.16.0: scipy.misc.comb(40,20) -> 137846528820.00006

令人沮丧的是,我了解到我必须round()在结果上调用函数,而不是直接转换为int()使用math.floor()/ math.ceil()用于Python 2/3的一致性.

导致两个Python/SciPy版本之间出现这种差异的原因是什么?

有没有理由SciPy开发人员不只是首先调用round()返回的结果scipy.misc.comb()?

python scipy

0
推荐指数
1
解决办法
1034
查看次数

标签 统计

python ×2

unix ×2

bash ×1

c++ ×1

dash-shell ×1

debugging ×1

deployment ×1

gdb ×1

html ×1

macos ×1

memory ×1

pep ×1

scipy ×1

setuptools ×1

shell ×1

terminal ×1