簡體   English   中英

將Pip安裝到錯誤的虛擬環境

[英]Pip installing to wrong virtual environment

我有兩個Django項目,每個項目都有一個名為myvenv的虛擬環境。 我正在嘗試使用pip安裝名為psycopg2的軟件包。 即使which pip命令確認pip在正確的虛擬環境中運行,它仍安裝在錯誤的虛擬環境中。

我重新啟動了Mac,以便在沒有運行任何虛擬環境的情況下啟動。 當我嘗試使用pip時,我的終端日志如下所示:

BillMacBookPro:~ billnoble$ cd ~/documents/yhistory-server
BillMacBookPro:yhistory-server billnoble$ source ~/documents/yhistory-    server/myvenv/bin/activate
(myvenv) BillMacBookPro:yhistory-server billnoble$ which pip
/Users/billnoble/Documents/YHistory-Server/myvenv/bin/pip
(myvenv) BillMacBookPro:yhistory-server billnoble$ brew install postgresql
Warning: postgresql-9.4.4 already installed
Warning: You are using OS X 10.11.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
(myvenv) BillMacBookPro:yhistory-server billnoble$ pip install psycopg2
Requirement already satisfied (use --upgrade to upgrade): psycopg2 in /Users/billnoble/Documents/VeeUServer/myvenv/lib/python3.4/site-packages
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

我已經在YHistory-Server目錄中成功啟動了我的虛擬環境,並且which pip確認它正在此虛擬服務器上運行。 但是,當我運行pip時,它抱怨該軟件包安裝在計算機上的另一個虛擬環境中。 為什么使用錯誤的路徑名? 如何使其安裝在正確的虛擬環境中?

我想當您創建第二個virtualenv時,您已經激活了第一個,並且可能將它們鏈接在一起。 嘗試重新創建虛擬環境,然后在創建第二個虛擬環境時,請確保停用首先創建的第一個虛擬環境。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM