简体   繁体   中英

Manually install a directory of python packages

My normal packages are located in /usr/local/lib/python2.7/dist-packages

I have another loose hanging folder named dist-packages that contains several custom python packages taken from a different VM.

Does anyone know if a simple cp the contents of of dist-packages to /usr/local/lib/python2.7/dist-packages do the trick? I don't want to do it and then have to manually sort out which files don't belong if it doesn't work.

Edit: Or ideally a way for python2.7 to reference the path of custom dist-packages .

You are not guaranteed to be able to do that.

IF the versions of python from both the parent directories of the two dist-packages is the same, then it will work, but you have to make sure it's the exact same version. Provided they are, you can do:

$ cp -r [path_to_loose_folder]/dist-packages/* /usr/local/lib/python2.7/dist-packages/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM