Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

python - "Failed building wheel for psycopg2" - MacOSX using virtualenv and pip

I'm attempting to make a website with a few others for the first time, and have run into a weird error when trying to use Django/Python/VirtualEnv. I've found solutions to this problem for other operating systems, such as Ubuntu, but can't find any good solutions for Mac.

This is the relevant code being run:

virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt

After running that block, I get the following errors:

AssertionError


Failed building wheel for django-toolbelt Running setup.py bdist_wheel for psycopg2

...

AssertionError


Failed building wheel for psycopg2 Failed to build django-toolbelt psycopg2

I believe I've installed the "django-toolbelt" and "psycopg2", so I'm not sure why it would be failing.

The only difference I can think of is that I did not use the command

sudo apt-get install libpq-dev

as was instructed for Ubuntu usage as I believe that installing postgresql with brew took care of the header.

Thanks for any help or insight!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I had the same problem on Arch linux. I think that it's not an OS dependant problem. Anyway, I fixed this by finding the outdated packages and updating then.

pip uninstall psycopg2
pip list --outdated
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2

hope this helps...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...