![](/img/trans.png)
[英]Install a Python package into a different directory using pip?
[英]Install Test Python Package in Different directory Using Pip
我有一個在生產中使用的python distutils模塊。 我在虛擬環境中安裝了該生產模塊。 但是,我希望能夠在生產環境中安裝之前測試升級。 我還試圖避免創建第二個虛擬環境。 因此,我嘗試了以下方法:
# inside my virtualenv
# checkout master of my repo
git clone git+git://github.com/myrepo
cd myrepo
# create directory where my testing install will live
mkdir testinstall
# prepend my testing install to the PYTHONPATH to over-ride the
# production install of my repo
export PYTHONPATH=$PWD/testinstall/lib/python2.7/site-packages:$PYTHONPATH
# install my local package with pip into the test area
pip install --prefix=$PWD/testinstall .
在這種情況下,我從pip得到錯誤:
Requirement already satisfied from /path/to/production/myrepo
如果我用
pip install --upgrade --prefix=$PWD/testinstall
pip繼續從/path/to/production/myrepo
卸載生產版本,並在testinstall
區域中安裝我的測試版本。
任何想法如何強制點子以這種方式安裝?
我只會使用新的venv,但如果您確實不能使用,請使用-t
(目標)選項。
pip3 install --upgrade -t my_new_directory
嘗試用這種方式代替
pip install --target=d:\somewhere\other\than\the\default package_name
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.