草庐IT

package-scoped

全部标签

python - 导入错误 : No module named package

我发现在Python中导入模块很复杂,所以我正在做实验来解决这个问题。这是我的文件结构:PythonTest/package/__init__.pytest.py__init__.py的内容:package='Variablepackagein__init__.py'frompackageimporttesttest.py内容:frompackageimportpackageprintpackage当我离开package(在PythonTest中)并执行pythonpackage/test.py时,我得到:Traceback(mostrecentcalllast):File"packa

Python代码组织问题: Eggs + Packages + Buildout + Unit Tests + SVN

我有几个共享通用模块的python项目。直到现在,我一直在……咳咳……保留公共(public)代码的多个副本并手动同步。但我显然更愿意做其他事情。在我看来,zc.Buildout可能就是我所需要的。我想我应该做的是将我系统的每个可重用组件放入一个单独的鸡蛋中,然后使用buildout将它们组装到项目中。我还认为,对于任何特定模块,我应该将单元测试放入单独的包或egg中,这样我就不会在每个项目中都安装组件单元测试的副本。我只想在我的库开发的地方进行单元测试,而不是在它刚刚被使用的地方。所以也许我想要这样的东西projectslib1testscodelib2testscodeapp1te

python - "from package import *"和 "import package"之间的性能

frompackageimport*和importpackage之间有什么性能差异吗? 最佳答案 不,差异不是性能问题。在这两种情况下,都必须解析整个模块,并且将执行任何模块级代码。唯一的区别是命名空间:首先,导入模块中的所有名称都将成为当前模块中的名称;第二种,当前模块中只定义了包名。也就是说,很少有充分的理由使用fromfooimport*。导入模块,或从中导入特定名称。 关于python-"frompackageimport*"和"importpackage"之间的性能,我们在St

python - TensorFlow 2.0 : how to group graph using tf. 喀拉斯? tf.name_scope/tf.variable_scope 不再使用了吗?

回到TensorFlowinception模块,通过使用tf.name_scope或tf将它们分组.variable_scope.利用这些运算符,我们能够方便地构造计算图,从而使TensorBoard的图View更容易解释。只是结构化组的一个例子:这对于调试复杂的架构非常方便。不幸的是,tf.keras似乎忽略了tf.name_scope并且tf.variable_scope在TensorFlow>=2.0中消失了。因此,像这样的解决方案......withtf.variable_scope("foo"):withtf.variable_scope("bar"):v=tf.get_va

python - 谷歌 API Python unauthorized_client : Unauthorized client or scope in request

尝试运行我的代码时出现此错误:oauth2client.client.AccessTokenRefreshError:unauthorized_client:Unauthorizedclientorscopeinrequest.这是我的代码:importjsonimportrequestsimporthttplib2fromoauth2client.clientimportSignedJwtAssertionCredentialsfromapiclient.discoveryimportbuildif__name__=='__main__':json_key_file='my-key.

android - "Parse Error : There is a problem parsing the package"安装安卓应用程序时

我在安装android应用程序时遇到此错误(ParseError:Thereisaproblemparsingthepackage.)。我做了以下步骤。我第一次安装应用程序,它运行良好。我对现有应用程序进行了更改,并更改了Manifest文件中的版本号。然后我导出应用程序并完成代码签名过程。为此,右键单击您的项目节点>选择导出。在那里你会看到一个向导。按照步骤完成代码签名。我得到了ARDemo.apk文件,然后我把它的名字改成了ARDemo1.apk然后我将这个apk文件发送到手机SD卡并开始安装我得到了上述错误。我用谷歌搜索,他们说解包list文件有问题。谁能告诉我我有什么问题?

android - "Parse Error : There is a problem parsing the package"安装安卓应用程序时

我在安装android应用程序时遇到此错误(ParseError:Thereisaproblemparsingthepackage.)。我做了以下步骤。我第一次安装应用程序,它运行良好。我对现有应用程序进行了更改,并更改了Manifest文件中的版本号。然后我导出应用程序并完成代码签名过程。为此,右键单击您的项目节点>选择导出。在那里你会看到一个向导。按照步骤完成代码签名。我得到了ARDemo.apk文件,然后我把它的名字改成了ARDemo1.apk然后我将这个apk文件发送到手机SD卡并开始安装我得到了上述错误。我用谷歌搜索,他们说解包list文件有问题。谁能告诉我我有什么问题?

python - 导入错误 : No module named 'nltk.tokenize' ; 'nltk' is not a package

我在Windows7的pycharmIDE中使用python3.5.2,但在导入nltk包时遇到问题。importnltk出现以下错误:Traceback(mostrecentcalllast):File"",line1,inFile"C:\ProgramFiles(x86)\JetBrains\PyCharmCommunityEdition2016.2.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py",line21,indo_importmodule=self._system_import(name,*args,**kwargs)

没有参数的 Python 'raise' : what is "the last exception that was active in the current scope"?

Python的文档说:Ifnoexpressionsarepresent,raisere-raisesthelastexceptionthatwasactiveinthecurrentscope.(Python3:https://docs.python.org/3/reference/simple_stmts.html#raise;Python2.7:https://docs.python.org/2.7/reference/simple_stmts.html#raise。)但是,“最后激活”的概念似乎已经改变。见证以下代码示例:#from__future__importprint_f

python - 导入错误 : No module named 'html.parser' ; 'html' is not a package (python3)

这个问题在这里已经有了答案:Importinginstalledpackagefromscriptwiththesamenameraises"AttributeError:modulehasnoattribute"or"ImportError:cannotimportname"(2个答案)关闭3年前。代码:fromhtml.parserimportHTMLParser追溯(最近的调用最后):File"program.py",line7,infromhtml.parserimportHTMLParserImportError:Nomodulenamed'html.parser';'htm