python - pysqlcipher 安装 - SyntaxError : Missing parentheses in call to 'print'

标签 python python-3.x encryption sqlite sqlcipher

我有 Python 3.4.2,我尝试在装有 Windows 8 的电脑上安装 pysqlcipher。 在我的命令提示符下输入以下代码后:

git clone https://github.com/leapcode/pysqlcipher/
cd pysqlcipher
python setup.py build_sqlcipher

我收到以下错误:

  File "setup.py", line 64
    print "CFLAGS", os.environ['CFLAGS']
                 ^
SyntaxError: Missing parentheses in call to 'print'

好像是打印的问题。我有 Python 3.4.2,此处使用的打印语法对应于 Python 2.X。我进行了大量搜索,但没有找到任何解决方案。

有人知道如何使用 Python 3.4.2 安装 pysqlcipher 吗?

感谢您的帮助!

PS:我已经关注了这个tutorial所有指示的事情都已完成。

最佳答案

看起来代码是为 Python 2 编写的。Python 3 包含一些更改,可能会使某些 Python 2 与 Python 3 不兼容。

Differences between python 2 and python 3

您可以使用包含的 2to3 工具将 setup.pycross_bdist_wininst.py 转换为 python 3 兼容代码。

只需运行 2to3 -w setup.py2to3 -w cross_bdist_wininst.py 即可转换 python 代码。自动转换工作得很好,但它确实错过了一个必要的转换。更改 setup.py

中的第 209 行
-- if sources is None or type(sources) not in (ListType, TupleType):
++ if sources is None or type(sources) not in (List, Tuple):

并删除第 30 行:

-- from types import ListType, TupleType

这应该允许您使用 python setup.py build_sqlcipher

进行编译

关于python - pysqlcipher 安装 - SyntaxError : Missing parentheses in call to 'print' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28715630/

相关文章:

python - 用数据框中组的平均值替换列值

C# 和 C++ 套接字数据加密

java - xml签名中的签名方法

Python 3.4 : check if a process ends

python - 使用 python 脚本在 Maya 中创建 UI

python - 从 Pandas Dataframe 创建 Numpy 数组时丢失字符串

php - MCRYPT 模式正在生成斜杠

python - 如何对浮点输出执行单元测试? - Python

python - 具有同一字符的多个实例的子字符串

python - 将 Base64 图像上传到 S3 并返回 URL