2013-07-05 30 views
20

Tôi đang cố gắng làm việc trên trang web của Pyladies trên thư mục cục bộ của mình. Tôi nhân bản repo, (https://github.com/pyladies/pyladies)! và tạo môi trường ảo. Tuy nhiên khi tôi làm pip cài đặt yêu cầu -r, tôi nhận được lỗi nàygevent/libevent.h: 9: 19: lỗi nghiêm trọng: event.h: Không có tệp hoặc thư mục nào như vậy

Installing collected packages: gevent, greenlet 
Running setup.py install for gevent 
building 'gevent.core' extension 
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/opt/local/include -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-i686-2.7/gevent/core.o 
In file included from gevent/core.c:253:0: 
gevent/libevent.h:9:19: fatal error: event.h: No such file or directory 
compilation terminated. 
error: command 'gcc' failed with exit status 1 
Complete output from command /home/akoppad/virt/pyladies/bin/python -c "import setuptools;__file__='/home/akoppad/virt/pyladies/build/gevent/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-4MSIGy-record/install-record.txt --install-headers /home/akoppad/virt/pyladies/include/site/python2.7: 
running install 

running build 

running build_py 

running build_ext 

building 'gevent.core' extension 

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -I/opt/local/include -fPIC -I/usr/include/python2.7 -c gevent/core.c -o build/temp.linux-i686-2.7/gevent/core.o 

In file included from gevent/core.c:253:0: 

gevent/libevent.h:9:19: fatal error: event.h: No such file or directory 

compilation terminated. 

error: command 'gcc' failed with exit status 1 

---------------------------------------- 
Command /home/akoppad/virt/pyladies/bin/python -c "import setuptools;__file__='/home/akoppad/virt/pyladies/build/gevent/setup.py'; exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-4MSIGy-record/install-record.txt --install-headers /home/akoppad/virt/pyladies/include/site/python2.7 failed with error code 1 in /home/akoppad/virt/pyladies/build/gevent 
Storing complete log in /home/akoppad/.pip/pip.log. 

Tôi đã cố gắng làm điều này, cổng sudo cài đặt libevent CFLAGS = "- I/opt/local/include -L/opt/local/lib "pip install gevent

Nó cho biết không tìm thấy lệnh cổng.

Tôi không chắc chắn cách tiếp tục điều này. Cảm ơn!

Trả lời

51

Tôi đã gặp vấn đề tương tự và cũng giống như câu trả lời khác được đề xuất tôi đã phải cài đặt "libevent". Nó dường như không được gọi là "libevent-devel" nữa (apt-get không thể tìm thấy nó) nhưng làm:

$ apt-cache search libevent 

liệt kê một loạt các gói sẵn có.

$ apt-get install libevent-dev 

làm việc cho tôi.

+0

cũng làm việc cho tôi (Ubuntu) – swietyy

+0

Hoàn hảo! Nó chỉ đơn giản là rocked :) – softvar

+0

Giải pháp này nên được đánh dấu là chính xác không phải là một trong những khác –

11

Tôi nghĩ bạn chỉ cần quên cài đặt "libevent" trong môi trường. Nếu bạn đang sử dụng máy OSX, hãy thử cài đặt brew tại đây http://mxcl.github.io/homebrew/ và sử dụng cài đặt brew libevent để cài đặt phụ thuộc. Nếu bạn đang dùng máy ubuntu, bạn có thể thử apt-get để cài đặt thư viện tương ứng.

+0

Cảm ơn bạn rất nhiều. Tôi đã cố gắng để làm sudo apt-get cài đặt libevent-devel bên trong môi trường ảo. Do đó lỗi. Tôi cài đặt nó bình thường bên ngoài môi trường ảo và nó được cài đặt một cách bình thường. Một lần nữa xin cảm ơn! –

2

Tôi có vấn đề này trong khi cố gắng

pip install Flask-Sockets 

sudo apt-get install libevent-dev 

làm việc cho tôi

1
yum install libevent-* 

lệnh này hoạt động đối với tôi vì tôi là trên centos.

1

Tôi đã gặp phải lỗi này trên MacOS 10.10.1 (Yosemite) chạy cài đặt pip. Giải pháp cho tôi là thêm đường dẫn vào libevent mà pip bị thiếu. Đây là các tệp C, và CFLAGS và DFLAGS là các biến môi trường bash cho phép pip biết nơi tìm các tệp này. Trên hệ thống của tôi, libevent được tìm thấy tại/usr/local/include/event2.

$ CFLAGS=-I/usr/local/include/event2 DFLAGS=-L/usr/local/lib pip install -r requires.txt 
Các vấn đề liên quan