我在Ubuntu16.04上通过以下代码将psycopg2安装到pypy3(Python3.5.3):
pypy3 -m pip install psycopg2
但是,我遇到了一些错误:
Error:b'You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.\n'
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-epd368s6/psycopg2
我在“You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application”中找到了解决方案。
我的计算机已经安装了Postgresql9.5,因此我使用了以下命令进行安装:
sudo apt-get install libpq-dev
pypy3 -m pip install psycopg2
没有错误报告,但是当我尝试“导入psycopg2”时,出现了ImportError:
enter image description here
我在“pypy3 import psycopg2 error (PyCodec_Encoder)”中发现了相同的错误,但没有找到解决方案。
有人知道如何解决吗?
最佳答案
您pointed to发出的PyPy问题包含答案“有人必须实现缺少的功能(以及其他缺少的PyCodec_ *功能。目前,我们在codec.py中仅实现了很少的功能。根据实现的功能中的模式,实现非常简单,最难的部分是编写测试。
有psycopg2cffi package,它应该可以在PyPy上运行并且会更快。如果可以满足您的需求,请尝试在此处进行评论。
关于python-3.x - pypy3 import psycopg2错误( undefined symbol :PyCoder_Encoder),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53338404/