在他们的Built-in Third-party Libraries页面上,它表示支持lxml
3.7.3,但我似乎无法找到使用它的方法。
如果我写app.yaml
:
- name: lxml
version: latest
当我在应用程序中记录etree.LXML_VERSION
时,我会得到(2, 3, 0, 0)
。
将版本专门设置为"3.7.3"
(而不是latest
)似乎不起作用。当我尝试部署时,gcloud说:
ERROR: (gcloud.app.deploy) An error occurred while parsing file: [... /app.yaml]
lxml version "3.7.3" is not supported, use one of: "2.3", "2.3.5"
in "... app.yaml", line 17, column 1
我已在./lib
文件夹中本地安装了lxml,但在部署时会忽略该文件夹。
我做错了吗?
答案 0 :(得分:1)
问题似乎发生了,因为旧的Google云端sdk。
sdk是使用In [196]: weights = tf.Variable(tf.zeros(shape=(3, 4)), name='weights')
In [197]: with tf.Session() as sess:
...: sess.run(weights.initializer)
...: print(weights.eval())
...:
# the result
[[ 0. 0. 0. 0.]
[ 0. 0. 0. 0.]
[ 0. 0. 0. 0.]]
安装的,不知何故它没有得到更新。这还包括一个较旧的Python SDK
此时latest Python SDK为apt-get
,我使用的是1.9.62
。
更新sdk似乎解决了问题
1.9.52
答案 1 :(得分:0)
这不是第一次文档之间存在不一致,云SDK中包含的内容,GAE语言特定SDK中包含的内容以及GAE(生产中)实际可用的内容。例如,请参阅PyCharm - Can't create App Engine Application using DJango。
您收到的部署错误消息表明,尽管在文档中标记为3.7.3
,但GAE上并不存在lxml
版本。
3.7.3
库位于一些需要特别注意的特殊库的列表中。很可能是因为它们不是“没有C扩展的纯Python代码”,因此它们不能与其他库一起包含在SDK中,因此它们需要在本地系统上单独安装。从Using built-in bundled libraries with the local development server开始(查看相关信息的整个部分):
运行时提供的许多内置库都是 自动可用于本地开发服务器。然而 必须先在本地安装以下内置库,然后才能进行 将它们与本地开发服务器一起使用:
现在,如果你真的想要app.yaml
版本,你可能会运气不好:如果它确实不是“没有C扩展的纯Python代码”那么你也将无法将它提供给你应用程序。不过,值得一试。一个新尝试,请注意您还需要:
libraries:
文件的appengine_config.py
部分中删除 - 您不再请求GAE提供的库app.yaml
文件。)如果这不起作用,那么您将不得不解决部署错误消息中提到的其中一个可用版本。你需要:
libraries:
文件的struct ScreenSize {
static let width = UIScreen.main.bounds.size.width
static let height = UIScreen.main.bounds.size.height
static let maxLength = max(ScreenSize.width, ScreenSize.height)
static let minLength = min(ScreenSize.width, ScreenSize.height)
static let frame = CGRect(x: 0, y: 0, width: ScreenSize.width, height: ScreenSize.height)
}
struct DeviceType {
static let iPhone4orLess = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.maxLength < 568.0
static let iPhone5orSE = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.maxLength == 568.0
static let iPhone678 = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.maxLength == 667.0
static let iPhone678p = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.maxLength == 736.0
static let iPhoneX = UIDevice.current.userInterfaceIdiom == .phone && ScreenSize.maxLength == 812.0
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad && ScreenSize.maxLength == 1024.0
static let IS_IPAD_PRO = UIDevice.current.userInterfaceIdiom == .pad && ScreenSize.maxLength == 1366.0
}
部分