Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
8 ตอบกลับ
48422 มุมมอง

Hi,

I am trying to install psycopg2 module.  but it is giving me the error "ImportError: No module named psycopg2". and when I try to install, it's showing like "Requirement already satisfied: psycopg2 in ./.local/lib/python3.6/site-packages (2.7.4)".

and the same for xmlrpc.client it's giving the error 

ERROR: Could not find a version that satisfies the requirement xmlrpclib (from versions: none)
ERROR: No matching distribution found for xmlrpclib.

Could anyone help me to resolve this error.

thanks in advance!


อวตาร
ละทิ้ง

try to install using pip

ผู้เขียน

already tried with pip, pip2, pip3 but no use.

คำตอบที่ดีที่สุด


I remember I've fixed this issue by uninstalling psycopg2 and installing the binary one

you can install it using these commands

sudo pip uninstall psycopg2    

pip install psycopg2-binary

using Pycharm interface :

1-Ctrl+alt+s  

2-search interpreter

3-on the right side of the window click on +

4-search psycopg2-binary and click install

if you still have the same problem make sure that you are using your system interpreter and not your virtualenv interpreter if you have installed the dependencies on your system

hope this helps someone,

อวตาร
ละทิ้ง

Thank so much. This resolve my problem.

This resolves my problem too. Thank you.

คำตอบที่ดีที่สุด


this working ...

sudo apt-get install libpq-dev

pip install psycopg2

sudo apt-get install build-dep python-psycopg2

pip3 install psycopg2


อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Thank you for sharing your journey with me.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Thank you, its so helpful!

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Make sure you are installing the module for the correct Python version. If you are using Python 3.6, ensure you are installing it for that version specifically. Also, if you are using a virtual environment, activate it before running the installation command.

 

อวตาร
ละทิ้ง

I forgot to mention that if you are trying to import xmlrpclib, update your code to use xmlrpc.client instead, as it's the correct module name for Python 3. Simple replace "import xmlrpclib" with "import xmlrpc.client". Of course, if your code is written for Python 2, you might need to update it to be compatible with Python 3, and this includes changing module names like in the example above.
Source: https://chi-nese.com/

คำตอบที่ดีที่สุด

To solve the error, install the module by running the pip install psycopg2-binary command.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

The error message "Requirement already satisfied: psycopg2 in ./.local/lib/python3.6/site-packages (2.7.4)" indicates that the psycopg2 module is already installed in your Python environment. However, you're still getting an import error, which suggests there might be some conflict with other modules or Python versions.



อวตาร
ละทิ้ง

To resolve this:
- Check your virtual environment: Make sure you're trying to import psycopg2 from the active virtual environment where it's installed.
- Verify installation path: Ensure you're using the correct Python version when running pip commands. For instance, if your command prompt shows Python 3.7 while you're trying to install for Python 3.6, it might lead to conflicts.
- Re-install psycopg2: Try reinstalling the psycopg2 module using pip. This can sometimes resolve any installation issues.
Sources: https://getaway-shootout.com

คำตอบที่ดีที่สุด

Hi pallavi,

in your system paclage is installed for python3 and and you are running odoo 13, so odoo 13 use python3.6. So in that case you need to install separate package for python3.6

can you please try bellow command:

python3.6 -m pip install PACKAGE_NAME
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
4
มิ.ย. 24
7887
0
เม.ย. 20
3992
4
ต.ค. 19
16116
0
เม.ย. 19
3114
1
เม.ย. 23
8080