Python - manually install package using virtualenv

后端 未结 4 495
不思量自难忘°
不思量自难忘° 2020-12-12 10:07

I have a python program I want to install into my virtualenv - it\'s a zip package that I need to unzip and then run a setup.py program - but my question is more regarding h

相关标签:
4条回答
  • 2020-12-12 10:28

    PACKAGE_DIR=/some/package/directory/path export VENV=$(pipenv --venv) && export BASE_DIR=$(pwd) && cd $PACKAGE_DIR && $VENV/bin/python setup.py install && cd $BASE_DIR

    0 讨论(0)
  • 2020-12-12 10:29

    I typically would extract the program to a temporary folder, then from that folder, run the setup.py using the direct path to the virtualenv python instance. eg if your virtualenv is in /home/username/virtualpy, use this (from your temporary folder)

    /home/username/virtualpy/bin/python setup.py install
    

    This should install it to your virtualenv site package folder.

    0 讨论(0)
  • 2020-12-12 10:32

    If a package won't install from repository, try under venv by use sudo. As example for python pathos package;

    /venv3.6/bin$ sudo pip3 install pathos
    
    0 讨论(0)
  • 2020-12-12 10:46

    well when you switch to the virtual environment. you should type

    which python

    and if it returns the path where your virtual environment exists then its okay you can directly run this command.

    $ python setup.py build
    $ python setup.py install
    

    but if it gives the global level path which is not your virtualenv's path then you should try using

    $ ~/.virtualenv/python-env/bin/python setup.py build
    $ ~/.virtualenv/python-env/bin/python setup.py install
    
    0 讨论(0)
提交回复
热议问题