Beginning PythonFrom Novice to Professional, Second Edition 2008 phần 7

Bây giờ bạn sẽ thấy đầu ra như sau: hoạt động xây dựng chạy build_py tạo xây dựng tạo xây dựng / lib sao chép - xây dựng / lib Distutils đã tạo ra một thư mục con được gọi là xây dựng, với một thư mục con có tên là lib, | CHAPTER 18 PACKAGING YOUR PROGRAMS 385 You should now see output like the following running build running build_py creating build creating build lib copying - build lib Distutils has created a subdirectory called build with yet another subdirectory named lib and placed a copy of in build lib. The build subdirectory is a sort of working area where Distutils assembles a package and compiles extension libraries for example . You don t really need to run the build command when installing because it will be run automatically if needed when you run the install command. Note In this example the install command will copy the module to some system-specific directory in your PYTHONPATH. This should not pose a risk but if you don t want to clutter your system you might want to remove it afterward. Make a note of the specific location where it is placed as output by . You could also use the -n switch to do a dry run. At the time of writing there is no standard uninstall command although you can find custom uninstallation implementations online so you ll need to uninstall the module by hand. Speaking of which . . . let s try to install the module python install Now you should see something like the following running install running build running build_py running install_lib copying build lib - path to python lib site-packages byte-compiling path to python lib site-packages to 386 CHAPTER 18 PACKAGING YOUR PROGRAMS Note If you re running a version of Python that you didn t install yourself and don t have the proper privileges you may not be allowed to install the module as shown because you don t have write permissions to the correct directory. This is the standard mechanism used to install Python modules packages and extensions. All you need to do is provide the little setup script. The sample script uses only the Distutils directive py_modules. If you want to install entire packages you

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.