在Windows 10上我安装并运行了python,但不在标准位置C:\PythonXY.
如何找出python安装的位置?
我希望能够安装一些 python 代码,使用 python-click 和命令,使用setup.py. 我有以下完整代码:
import click
@click.group()
@click.option(
"-v",
"--verbose",
count=True,
default=0,
help="-v for DEBUG",
)
def cli(verbose):
print(verbose)
@cli.command("list")
@click.option(
"--option1"
)
def my_list_command(option1):
print(option1)
@cli.command("find")
@click.option(
"--option2"
)
def my_find_command(option2):
print(option2)
if __name__ == '__main__':
cli()
Run Code Online (Sandbox Code Playgroud)
它定义了两个命令list和find。例如,当我按照mycode.py我的方式保存该文件时
python mycode.py list --option1 opt1
python mycode.py find --option2 opt2
Run Code Online (Sandbox Code Playgroud)
并且代码按预期工作,即我有两个带有选项的命令。
但是,当我现在尝试安装此代码setup.py如下
from setuptools import setup, find_packages
setup(
name='MyCode',
install_requires=[
'click',
],
entry_points={
'console_scripts': [
'mytest=mycode.cli'
],
},
) …Run Code Online (Sandbox Code Playgroud) 我有一个在 AndroidStudio 中编译的 android 应用程序,但是当我调用某个活动时,我收到以下错误:
11-22 16:08:40.461 13796-13796/com.impyiablue.stoxx E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.impyiablue.stoxx, PID: 13796
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.impyiablue.stoxx/com.impyiablue.stoxx.EditEntryActivity}: java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_width attribute.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2305)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
Caused by: java.lang.RuntimeException: Binary XML file line #25: You must supply a layout_width attribute.
at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:606)
at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:6422)
at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6591)
at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1866)
at …Run Code Online (Sandbox Code Playgroud) 我是javascript的新手,所以也许我错过了显而易见的事情.
我有以下脚本(另见其他答案):
<script>
var d = new Date();
document.getElementById("demo").innerHTML = d.toLocaleFormat("DD.MM.YYYY");
</script>
Run Code Online (Sandbox Code Playgroud)
我想用它来创建jacasvript中的格式化日期.如果日期是今天(2015年6月26日),我希望此脚本生成以下字符串:
26.06.2015
Run Code Online (Sandbox Code Playgroud)
但是,我得到的是以下内容:
DD.MM.YYYY
Run Code Online (Sandbox Code Playgroud)
另一个答案是错的吗?如何在没有额外库的情况下获得此格式化日期?
我也尝试使用parse或format取而代之的是没有成功.