简体   繁体   中英

pip3 installs modules to location python3 can't find

I have pip3, installed via the yum install of python3-pip.

I've done a pip3 global install of some modules I need, but python3 can't find them to import. After a little investigation I see that pip3 installed the modules to /usrlib/python3.6/site-packages/pip/_vendor/

The problem is that python3 doesn't seem to know to look at pip/_vendor, it only finds modules directly installed under site-package. If I just copy the modules from .../site-package/pip/_vendor to .../site-package everything works fine.

The issue doesn't appear to be related to file permissions or ability to read the modules.

I'm wondering how I configure either pip to install directly to site-package or python3 to understand how to look in the pip/_vendor location.

I'm configuring this all with ansible and would like as module an option as possible. For instance I could manually use an argument to tell pip3 to install to the folder I want, but I don't want to hardcode the exact site-package directory if I don't have to.

I recommend starting over with pip by downloading and running get-pip.py . This will not only install the latest version of pip , but it will also install packages to a Python-readable location (the version of Python you use to run get-pip.py ).

As an aside, I would avoid installing packages system-wide unless there is a specific need for them. At the very least, you should be installing them as a regular user, and even better you should be using a virtualenv.

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