社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
私信  •  关注

phd

phd 最近创建的主题
phd 最近回复了

忽略此shell语法的所有错误:

git submodule foreach "git checkout featureABC || :"

: 意思是“什么都不做”。

7 年前
回复了 phd 创建的主题 » 无法访问激活的python环境的包

导入:未找到命令。

/bin/sh 当然,shell不知道如何解释Python脚本。所以要么你需要一个shebang要么总是像

python script

至于shebang,可以使用 $PATH 做舍邦线

#!/usr/bin/env python

/usr/bin/env $路径

为了防止密钥登录和解决重定向问题,密码提示通过 /dev/tty . 看看Python的 getpass .

7 年前
回复了 phd 创建的主题 » git子模块foreach不作为别名

对我有效(几乎):

$ git config alias.all

$ git config alias.all '!f(){ git submodule foreach "git $@ || true"; }; f'

$ git config alias.all
!f(){ git submodule foreach "git $@ || true"; }; f

$ git all checkout master
Entering 'genxml'
/usr/lib/git-core/git-submodule: 342: /usr/lib/git-core/git-submodule: git checkout: not found
Stopping at 'genxml'; script returned non-zero status.

嗯,奇怪的是,我希望它的工作方式和下面一样:

$ git all "checkout master"
Entering 'genxml'
error: pathspec 'master' did not match any file(s) known to git.
Entering 'third-party/c14n2'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/cmclib'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/eplant'
Already on 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/pycryptoserver'
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
Entering 'third-party/ufod'
warning: unable to rmdir ufod/xsd: Directory not empty
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.

至少这是意料之中的。

你可以把它解码成str receive.decode('utf_8') .

pyfinite is Python3-only ,它不适用于Python2.7。

7 年前
回复了 phd 创建的主题 » python无法从包中导入模块

从common.util导入我的函数

在python 3中,这是一个绝对导入,即 common/ 子目录必须在 sys.path . 在你的情况下,这肯定是一种错误的做法。

from.common.util导入我的函数

此导入需要 common 成为 foo 但事实并非如此。

从myproject.common.util导入my_func

这最终是最好的方法,但是对于它来说 myproject/ 子目录必须在 搜索路径 . 要么你安装整个 myproject 或将父目录添加到 $PYTHONPATH 环境变量或将目录添加到 搜索路径 在里面 foo/main.py . 类似于:

PYTHONPATH=/home/to/parentdir /home/to/parentdir/myproject/foo/main.py

或

import sys
sys.path.insert(0, '/home/to/parentdir')

/home/to/parentdir 是目录中 MyPosits 是。

安装后 我的计划 或将其父目录添加到 搜索路径 也可以使用相对导入。你要记住 常见的 是与 福 所以进口一定不是来自 .common 但来自 ..common :

from ..common.util import my_func

分成两个命令:

cd $HOME/git
git clone https://github.com/Project/project.git

这样你只给这个项目命名一次。

也许这也是过度指定,如果PY4实际上是一个甚至正在考虑的东西,最好将其排除在外并添加进来?

确切地!

核心开发人员甚至还没有开始讨论Python4,更不用说规划或实现了。他们还承诺不会像2比3过渡时期那样打破现状。

拥有如此遥远的未来和向后兼容的承诺,现在保护自己免受未知和意外的破坏还为时过早。至少等到核心开发人员开始讨论Python4。

7 年前
回复了 phd 创建的主题 » 禁止PowerShell中git命令的输出

只需添加选项 -q :

git clean -fdq
7 年前
回复了 phd 创建的主题 » 如何使用.gitignore反向选择

忽略所有内容,Unignore顶级应用程序及其下的所有内容:

*
!/app/
!/app/*
8 年前
回复了 phd 创建的主题 » Git跟踪不同的分支进行推拉?

我使用以下配置:

 git remote add review ssh://user@review.example.com:29418/repo
 git config remote.pushDefault review
 git config remote.review.fetch master:master
 git config remote.review.push master:refs/for/master

即添加名为 review ,为所有分支设置默认的Push Remote 到 回顾 ,为配置提取/拉 master 从远程分支 主人 , 配置推送 主人 到远程分支 refs/for/master .