草庐IT

install_dir

全部标签

python - 为什么 __mro__ 没有出现在 dir(MyClass) 中?

classMyClass(object):passprintMyClass.__mro__printdir(MyClass)输出:(,)['__class__','__delattr__','__dict__','__doc__','__format__','__getattribute__','__hash__','__init__','__module__','__new__','__reduce__','__reduce_ex__','__repr__','__setattr__','__sizeof__','__str__','__subclasshook__','__weak

python - 如何避免 flake 8's "F821 undefined name '_' “when _ has been installed by gettext?

问题概述:在我的项目的主脚本中,gettext安装函数_(),该函数在其他模块中用于翻译(如print(_('Something翻译'))).如thedoc所述:the_()function[is]installedinPython’sbuiltinsnamespace,soitiseasilyaccessibleinallmodulesofyourapplication.所以,一切正常。唯一的问题:flake8显示错误(实际上由PyFlakes返回):$flake8*.pylib.py:2:12:F821undefinedname'_'main_script.py:8:7:F821u

python - dir_util.copy_tree 在 shutil.rmtree 之后失败

我正在尝试将文件夹删除后复制到另一个文件夹:foriinrange(0,3):try:dir_util.remove_tree("D:/test2")#shutil.rmtree("D:/test2")print"removed"except:passdir_util.copy_tree("D:/test1","D:/test2")printiD:/test1包含一个名为test_file的空文件。如果我使用dir_util.remove_tree它工作正常,但在shutil.rmtree之后它只工作一次,在第二次迭代时失败。输出:removed0removedTraceback(mo

python - Django 1.8 TEMPLATE_DIRS 被忽略

这让我发疯。我做了一些奇怪的事情,似乎我的TEMPLATE_DIRS条目被忽略了。我只有一个settings.py文件,位于项目目录中,它包含:TEMPLATE_DIRS=(os.path.join(BASE_DIR,'templates'),os.path.join(BASE_DIR,'web_app/views/'),)我将项目级模板放在/templates文件夹中,然后在我的应用程序文件夹中有不同View类别的文件夹(例如身份验证View、帐户View等)。例如,我的主索引页面View在web_app/views/main/views_main.py中,看起来像fromweb_a

python - 你如何使用 easy_install 安装 django 旧版本?

我刚刚因为django1.3破坏了我的环境。我的网站都无法运行。所以,我决定使用virtualenv来设置不同版本的python和django的虚拟环境。但是,如果我下载软件包并使用“sudopythonsetup.pyinstall”进行安装,这似乎不会添加到我的虚拟环境中,而是添加到我的原始环境中。我在虚拟环境virtualenv_name/bin文件夹中尝试了“easy_installdjango”,它成功了,但问题是django1.3被自动选择并被添加。我想安装django1.2.5,有没有一种方法可以轻松地安装到我的虚拟环境中? 最佳答案

python - pip install numpy (python 2.7) 失败,错误代码为 1

我在python2.7.9上通过pip安装numpy...我检查了piplist,它返回了pip(1.5.6),setuptools(12.0.4)。我在Windows764位上运行,我已经尝试过Python32和64位版本。pipinstallnumpy结束于:CommandC:\Python27\python.exe-c"importsetuptools,tokenize;__file__='c:\\users\\jon\\appdata\\local\\temp\\pip_build_jon\\numpy\\setup.py';exec(compile(getattr(token

python - 合作实验室 : How to install and use on local machine?

GoogleColab非常好用,但我希望我可以完全在本地和离线运行Colab笔记本,就像从本地提供的Jupyter笔记本一样?我该怎么做?有没有我可以安装的Colab包?编辑:之前对该问题的一些回答似乎提供了访问由Google托管的Colab的方法。但这不是我要找的。我的问题是如何pipinstallcolab以便在pipinstalljupyter之后像jupyter一样在本地运行它。Colab包似乎不存在,所以如果我需要它,我该怎么做才能从源安装它? 最佳答案 从这里Githublink,似乎GoogleColab可能不会(或保

python - 我得到 OSError : [Errno 13] Permission denied: <dir name>, 并且 os.walk 退出

我有一个脚本来向我报告目录中的所有文件,以便用户将被要求删除它们(这是一个管理不善的集群,没有真正的super用户)。当我运行脚本时,我得到:OSError:[Errno13]权限被拒绝:'ls::权限被拒绝我不能写目录名(公司政策)代码是:#!/depot/Python-3.1.1/bin/python3.1fromstatimport*importstatimportsysfromcollectionsimportdefaultdictfrompwdimportgetpwuidimportsyssys.path.append('/remote/us01home15/ldagan/p

python - 有时 pip install 很慢

我确定这不是网络问题。我的一些机器使用pip安装包非常快,而其他一些机器很慢,从日志中,我怀疑速度慢是因为它会编译包,我想知道如何避免这种编译来进行pip安装快速地。这是慢速pip安装的日志。Collectingnumpy==1.10.4(from-rrequirements.txt(line1))Downloadingnumpy-1.10.4.tar.gz(4.1MB)100%|████████████████████████████████|4.1MB95kB/sRequirementalreadysatisfied(use--upgradetoupgrade):wheel==0.

python - 如何下载没有 "installing"的 Anaconda 软件包?

见标题。我想从Anaconda存储库下载一个压缩包以供以后安装。我将如何使用conda工具来做到这一点? 最佳答案 使用--download-only标志。$condainstall--helpusage:condainstall[-h][--revisionREVISION][-y][--dry-run][-f][--fileFILE][--no-deps][--only-deps][-m][-C]...--download-onlySolveanenvironmentandensurepackagecachesarepopula