Combine --user with --prefix error with setup.py install

后端 未结 5 1511
余生分开走
余生分开走 2020-11-30 18:53

I was trying to install Python packages a system I recently gained access to. I was trying to take advantage of Python\'s relatively new per user site-packages directory, an

5条回答
  •  自闭症患者
    2020-11-30 19:54

    Posting to save others time, as no available answers worked for me...

    In some environments, using the --target (-t) switch will still hit the same error. In my testing on two flavors of linux, I encountered the same issue when using the --prefix= parameter.

    Code:

    PYTHONUSERBASE=/tmp/ pip install --user --force-reinstall $PACKAGE
    

    Explanation: My workaround, which seems to work across many environments (MacOS, Amazon Linux, Debian) is to set the PYTHONUSERBASE environment variable to a temp location. --force-reinstall is used to trigger the local installation even when the package is already installed.

    This will result in the module being compiled/installed (depending on the OS and Python version) to: /tmp/lib/python2.7/site-packages/*

提交回复
热议问题