Python install home prefix




















Active Oldest Votes. Improve this answer. Mark Rushakoff Mark Rushakoff k 43 43 gold badges silver badges bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. If you installed Python from source, with an installer from python. However do yourself a favour and use the installer to install to the default prefix.

Some things maynot build when installed elsewhere. One of the reasons Homebrew justworks relative to the competition is because we recommend installinghere. Pick another prefix at your peril! Create a Homebrew installation wherever you extract the tarball.

Whichever brew command is called is where the packages will be installed. You can use this as you see fit, e. For A handfulrequire a full Xcode installation. Next, the archive will unpack into a similarly-named directory: foo Additionally, the distribution will contain a setup script setup.

Or rather, the above command is everything you need to get out of this manual. As described in section Distutils based source distributions , building and installing a module distribution using the Distutils is usually one simple command to run from a terminal:. You should always run the setup command from the distribution root directory, i. Then, open a command prompt window and run:.

Running setup. If you prefer to work incrementally—especially useful if you want to customize the build process, or if things are going wrong—you can use the setup script to do one thing at a time. This is particularly helpful when the build and install will be done by different users—for example, you might want to build a module distribution and hand it off to a system administrator for installation or do it yourself, with super-user privileges.

For example, you can build everything in one step, and then install everything in a second step, by invoking the setup script twice:. If you do this, you will notice that running the install command first runs the build command, which—in this case—quickly notices that it has nothing to do, since everything in the build directory is up-to-date. As implied above, the build command is responsible for putting the files to install into a build directory.

For example:. Or you could do this permanently with a directive in your system or personal Distutils configuration file; see section Distutils Configuration Files.

In that case, the temp. In either case, the lib or lib. In the future, more directories will be added to handle Python scripts, documentation, binary executables, and whatever else is needed to handle the job of installing Python modules and applications.

They are always the same under Windows, and very often the same under Unix and macOS. You can find out what your Python installation uses for prefix and exec-prefix by running Python in interactive mode and typing a few simple commands.

Under Unix, just type python at the shell prompt. Once the interpreter is started, you type Python code at the prompt. For example, on my Linux system, I type the three Python statements shown below, and get the output as shown, to find out my prefix and exec-prefix :. A few other placeholders are used in this document: X. Y stands for the version of Python, for example 3.

Dots and capitalization are important in the paths; for example, a value that uses python3. If you want to customize your installation directories more heavily, see section Custom Installation on custom installations. Often, it is necessary or desirable to install modules to a location other than the standard location for third-party Python modules. For example, on a Unix system you might not have permission to write to the standard third-party module directory.

Or you might wish to try out a module before making it a standard part of your local Python installation. This is especially true when upgrading a distribution already present: you want to make sure your existing base of scripts still works with the new version before actually upgrading.

The Distutils install command is designed to make installing module distributions to an alternate location simple and painless. The basic idea is that you supply a base directory for the installation, and the install command picks a set of directories called an installation scheme under this base directory in which to install files.

The details differ across platforms, so read whichever of the following sections applies to you. It is enabled with a simple option:. Files will be installed into subdirectories of site. This scheme installs pure Python modules and extension modules in the same location also known as site. The advantage of using this scheme compared to the other ones described below is that the user site-packages directory is under normal conditions always included in sys.

This scheme can be used by anyone, regardless of the operating system they are installing for. The --home option defines the installation base directory.

Files are installed to the following directories under the installation base as follows:. However, there are at least two known cases where the prefix scheme will be useful. This can be done with. This could be done with. In either case, the --prefix option defines the installation base, and the --exec-prefix option defines the platform-specific installation base, which is used for platform-specific files. Currently, this just means non-pure module distributions, but could be expanded to C libraries, binary executables, etc.

If --exec-prefix is not supplied, it defaults to --prefix. Files are installed as follows:. There is no requirement that --prefix or --exec-prefix actually point to an alternate Python installation; if the directories listed above do not already exist, they are created at installation time. Incidentally, the real reason the prefix scheme is important is simply that a standard Unix installation uses the prefix scheme, but with --prefix and --exec-prefix supplied by Python itself as sys.

Note that installing extensions to an alternate Python installation has no effect on how those extensions are built: in particular, the Python header files Python.

It is your responsibility to ensure that the interpreter used to run extensions installed in this way is compatible with the interpreter used to build them. The best way to do this is to ensure that the two interpreters are the same version of Python possibly different builds, or possibly copies of the same build.

The installation base is defined by the --prefix option; the --exec-prefix option is not supported under Windows, which means that pure Python modules and extension modules are installed into the same location. You might want to tweak just one or two directories while keeping everything under the same base directory, or you might want to completely redefine the installation scheme.

To create a custom installation scheme, you start with one of the alternate schemes and override some of the installation directories used for the various types of files, using these options:.



0コメント

  • 1000 / 1000