设置PGAdmin4 - Psycopg错误

时间:2016-12-06 18:08:01

标签: python-2.7 psycopg2 mint pgadmin-4

我已经安装了PostgreSQL 9.6,我正在尝试设置PGAdmin4。我正在使用Linux Mint 17.3。为了进行设置,我运行了以下命令:

1)我确保运行sudo apt-get install python-devsudo apt-get install libpq-dev

1)在我的主目录中,我运行了命令:virtualenv pgadmin4

2)我进入了目录:cd pgadmin4

3)我激活了我的虚拟环境:source bin/activate

4)我运行以下命令来检索Python轮:wget https://ftp.postgresql.org/pub/pgadmin3/pgadmin4/v1.1/pip/pgadmin4-1.1-py2-none-any.whl

5)我在我的虚拟环境中安装了pgadmin4及其所有依赖项:pip install pgadmin4-1.1-py2-none-any.whl

6)我修改了config_local.py以包含SERVER_MODE = False

7)我运行了命令:python ./lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

然后我得到了以下追溯:

Traceback (most recent call last):
  File "./lib/python2.7/site-packages/pgadmin4/pgAdmin4.py", line 46, in <module>
    app = create_app()
  File "/home/samuel/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/__init__.py", line 241, in create_app
    driver.init_app(app)
  File "/home/samuel/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/utils/driver/__init__.py", line 40, in init_app
    DriverRegistry.load_drivers()
  File "/home/samuel/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/utils/driver/registry.py", line 88, in load_drivers
    module = import_module(module_name)
  File "/home/samuel/pgadmin4/lib/python2.7/site-packages/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/samuel/pgadmin4/lib/python2.7/site-packages/pgadmin4/pgadmin/utils/driver/psycopg2/__init__.py", line 23, in <module>
    import psycopg2
  File "/home/samuel/pgadmin4/lib/python2.7/site-packages/psycopg2/__init__.py", line 50, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: /home/samuel/pgadmin4/lib/python2.7/site-packages/psycopg2/_psycopg.so: undefined symbol: PyMemoryView_Type

我已经研究了这个问题的解决方案了一段时间,但我还没有能够通过我的谷歌搜索找到任何东西。知道我需要做些什么来让pgadmin4运行吗?

1 个答案:

答案 0 :(得分:0)

我想出来了。我的系统默认配置为使用Python 2.6,因此我使用了错误的解释器。

解决方案是运行:

python2.7 ./lib/python2.7/site-packages/pgadmin4/pgAdmin4.py

而不是:

python ./lib/python2.7/site-packages/pgadmin4/pgAdmin4.py