python-3.x - 在 GCP 应用程序机器上安装 s2geometry 时遇到问题
问题描述
嘿大家,
我最近开始在自己的计算机和环境上使用s2geometry ,一切都很棒。问题是我现在正试图在谷歌云 App Engine 上使用我的代码,但在安装 s2geometry 时遇到了一个我不知道如何解决的错误。
这是我所做的:
mkdir s2geo
cd s2geo
git clone https://github.com/google/s2geometry.git
cd s2geometry
mkdir build
cd build
cmake \
-DGTEST_ROOT=/home/path_to_googletest \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.7m \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so ..
sudo make
sudo make install
起初我在做的时候遇到了一些问题,因为 python 可执行文件是 python2 因此所有的标志。使用这些标志,我在这样做时没有遇到任何问题,但是每当我尝试导入 s2 时,我都会遇到以下错误:
File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dynamic module does not define module export function (PyInit__pywraps2)
据我了解,这是一个错误,因为 Python 正在从已编译的 *.so 文件而不是 *.py 文件加载模块。该错误是由链接到 Python 2 库而不是 Python 3 库的 *.so 文件引起的。或者至少这是我在这里找到的:https ://github.com/pytorch/ELF/issues/98
所以我的问题是:我做错了什么?Python 2 是默认 Python 解释器的问题吗?我必须提到什么标志才能正确安装模块。
非常感谢。
解决方案
推荐阅读
- c# - Using C# Linq to test if string contains parts of a list of string
- java - 使用 SQLite 在 android 中忘记密码
- sql - Postgresql 使用默认值左连接 date_trunc
- php - 在 bcrypt laravel 5 中使用 slug?
- python-3.x - Dockerized Tensorflow 脚本看不到 GPU
- sql - 如何根据条件从同一个表中的不同行中选择值
- sql-server - 如何在 Sql Server 中计算日期时间
- reactjs - 我正在尝试将此表单的 useMemo 钩子用于名称
- java - 如何循环播放音频文件:结束后再次播放 javax.sound.sampled
- javascript - 无法在页面上显示地图,Openlayers ASP.NET 核心