2012-11-27 26 views
26

cách chạy lệnh saucách tạo virtualenv với pypy?

virtualenv -p /usr/local/bin/pypy pypy 

thoát với lỗi như

Running virtualenv with interpreter /usr/local/bin/pypy 
New pypy executable in pypy/bin/pypy 
debug: WARNING: Library path not found, using compiled-in sys.path. 
debug: WARNING: 'sys.prefix' will not be set. 
debug: WARNING: Make sure the pypy binary is kept inside its tree of files. 
debug: WARNING: It is ok to create a symlink to it from somewhere else. 
'import site' failed 
AttributeError: 'module' object has no attribute 'prefix' 
ERROR: The executable pypy/bin/pypy is not functioning 
ERROR: It thinks sys.prefix is u'/Users/myname' (should be u'/Users/myname/pypy') 
ERROR: virtualenv is not compatible with this system or executable 

Tôi đang chạy Mac OS X 10.8.1 (Mountain Lion) với CPython 2.7.3 và cài đặt PyPy 1.9 sử dụng Brew. phiên bản virtualenv là 1.8.4

Sử dụng được xây dựng trước nhị phân PyPy dành cho Mac OS X tải trực tiếp từ trang web của PyPy của không thực hiện bất kỳ sự khác biệt

+0

Tôi gặp lỗi tương tự trên OS X và có cùng phiên bản pypy và virtualenv với bạn (cũng đã cài đặt pypy từ homebrew) – hasen

Trả lời

22

này dường như là một hồi quy trong 1.8.4. Trong khi thử điều này trên hệ thống của tôi tất cả mọi thứ đã làm việc tốt với virtualenv 1.8.2, sau đó tôi nâng cấp và bây giờ tôi nhận được lỗi tương tự như bạn.

+3

Tôi đã gửi báo cáo lỗi tại https://github.com/pypa/virtualenv/ vấn đề/366 –

+2

Tôi hạ cấp xuống 1.8.2 và đã hoạt động! Cảm ơn! Vì đây là câu trả lời tôi nghĩ bạn nên nhắc đến * cách * hạ cấp xuống 1.8.2 '' 'sudo pip install virtualenv == 1.8.2''' – hasen

1

Tôi gặp lỗi tương tự trên Windows khi sử dụng virtualenv 1.8.2. Cũng tương tự như vấn đề với 1,9 và 1,10. Những gì làm việc cho tôi là chạy nó một lần để tạo thư mục, sao chép các tập tin bị thiếu, sau đó chạy lại để hoàn thành nó.

virtualenv -p c:\bin\pypy\pypy.exe pypy 
copy c:\bin\pypy\lib_pypy \virtualenvs\pypy 
copy c:\bin\pypy\lib-python \virtualenvs\pypy 
virtualenv -p c:\bin\pypy\pypy.exe pypy 
+0

Tôi đã xác nhận điều này hoạt động trên Windows7 cho PyPy 2.2.0. Sự khác biệt duy nhất là activate nằm trong thư mục con bin thay vì thư mục con Scripts

0

Với PyPy-4.0.1 và virtualenv 14.0.3, out of the box tôi nhận được một lỗi:

Q:\>c:\pypy\bin\virtualenv -p c:\pypy\pypy.exe my_pypy_virtualenv 
Already using interpreter c:\pypy\pypy.exe 
New pypy executable in Q:\my_pypy_virtualenv\bin\pypy.exe 
debug: OperationError: 
debug: operror-type: ImportError 
debug: operror-value: No module named UserDict 
ERROR: The executable Q:\my_pypy_virtualenv\bin\pypy.exe is not functioning 
ERROR: It thinks sys.prefix is u'q:\\' (should be u'q:\\my_pypy_virtualenv') 
ERROR: virtualenv is not compatible with this system or executable 
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem. 

Tìm kiếm trên PyPy gốc cài đặt cho UserDict*, tôi thấy UserDict.py trong lib-python\2.7 nhưng trong số lib-python\2.7 của virtualenv chỉ có userdict.py và không có tệp nào trong số User được viết hoa. Sau ví dụ về các giải pháp khác, tôi đã xóa userdict.py của virtualenv và sao chép các tệp User* gốc và chạy lại lệnh virtualenv và nó chạy mà không có lỗi.