问题:pip安装后,virtualenvwrapper.sh在哪里?

我正在尝试在OSX上设置virtualenvwrapper,发现的所有说明和教程都告诉我向.profile添加源命令,指向virtualenvwrapper.sh。我已经检查了所有的python和site-packages目录,但找不到任何virtualenvwrapper.sh。这是我需要单独下载的东西吗?pip安装不正确吗?

这是/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenvwrapper的内容:

hook_loader.py      hook_loader.pyc     project.py      project.pyc     user_scripts.py     user_scripts.pyc

如您所见,没有virtualenvwrapper.sh。它在哪里?

I’m trying to setup virtualenvwrapper on OSX, and all the instructions and tutorials I’ve found tell me to add a source command to .profile, pointing towards virtualenvwrapper.sh. I’ve checked all the python and site-packages directories, and I can’t find any virtualenvwrapper.sh. Is this something I need to download separately? Is pip not installing correctly?

This is the contents of /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/virtualenvwrapper:

hook_loader.py      hook_loader.pyc     project.py      project.pyc     user_scripts.py     user_scripts.pyc

As you can see, no virtualenvwrapper.sh. Where is it?


回答 0

您可以使用以下find命令搜索文件:

find / -name virtualenvwrapper.sh

这将从根目录的所有目录中搜索该文件。


在ubuntu 12.04 LTS上,通过pip安装,它已安装到

/usr/local/bin/virtualenvwrapper.sh


在ubuntu 17.04上,以pip身份作为普通用户安装,它已安装到

~/.local/bin/virtualenvwrapper.sh

You can use the find command to search for a file:

find / -name virtualenvwrapper.sh

This will search all directories from the root for the file.


on ubuntu 12.04 LTS, installing through pip, it is installed to

/usr/local/bin/virtualenvwrapper.sh


on ubuntu 17.04, installing through pip as a normal user, it is installed to

~/.local/bin/virtualenvwrapper.sh


回答 1

您已经尝试过吗?

$ which virtualenvwrapper.sh

did you already try this ?

$ which virtualenvwrapper.sh

回答 2

我只是用pip重新安装了它。

sudo pip uninstall virtualenvwrapper
sudo pip install virtualenvwrapper

这次将其放在/ usr / local / bin中。

I just reinstalled it with pip.

sudo pip uninstall virtualenvwrapper
sudo pip install virtualenvwrapper

And this time it put it in /usr/local/bin.


回答 3

各个OS所存储/定位的virtualenvwrapper.sh 的确切路径 有所不同。即使在相同的操作系统中,它也因版本而异因此,我们需要适用于所有OS版本的通用解决方案。

我找到其路径的最简单方法是

pip uninstall virtualenvwrapper

这将提示您进行确认。说“否”,但确认的第一行显示virtualenvwrapper.sh的路径(提示提供了将删除的文件列表,如果您说是的话。此列表中的第一项包含您计算机中virtualenvwrapper.sh的路径)

The exact path where virtualenvwrapper.sh is stored/located varies from OS to OS. Even with in same OS, it varies from version to version. So we need a generic solution that works for all OS versions.

Easiest way I have found to find its path is: Do

pip uninstall virtualenvwrapper

This will prompt a confirmation. Say “No” But first line of confirmation shows the path of virtualenvwrapper.sh (Prompt gives a list of files it will delete, if you say Yes. First entry in this list contains path to virtualenvwrapper.sh in your machine)


回答 4

或者像我一样..只需卸载virtualenvwrapper

sudo pip卸载virtualenvwrapper

然后使用easy_install进行安装

sudo easy_install virtualenvwrapper

这次我发现已安装文件“ /usr/local/bin/virtualenvwrapper.sh ” …在此之前,即使通过此命令我也找不到任何位置的文件

查找/ -name virtualenvwrapper.sh

or, like I did..just uninstall virtualenvwrapper

sudo pip uninstall virtualenvwrapper

and then install it with easy_install

sudo easy_install virtualenvwrapper

this time I found the file “/usr/local/bin/virtualenvwrapper.sh” installed… Before that I weren’t finding that file anywhere even by this command

find / -name virtualenvwrapper.sh


回答 5

在Mac OS上

which virtualenvwrapper.sh

你懂得

/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

而且你可以

sudo ln /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.sh

在你的 .bash_profile

source /usr/local/bin/virtualenvwrapper.sh

或者你可以

source /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

On Mac OS

which virtualenvwrapper.sh

u got

/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

and u can

sudo ln /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.sh

and in your .bash_profile

source /usr/local/bin/virtualenvwrapper.sh

or u can

source /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

回答 6

在OS X 10.8.2中,使用Python 2.7:

/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh

In OS X 10.8.2, with Python 2.7:

/Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh


回答 7

在OSx EI机长中,我将virtualenvwrapper安装为

sudo pip3 install virtualenvwrapper

,但是我在中找不到virtualenvwrapper.sh /user/local/bin,它终于在找到了/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh,您可以通过以下方式建立到/ usr / local / bin的软链接:

ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.sh,您可以按照官方文档的说明按照安装指南进行操作。祝好运!

In OSx EI captain, I installed the virtualenvwrapper as

sudo pip3 install virtualenvwrapper

, however I cannot find the virtualenvwrapper.sh in /user/local/bin, it was finally found at /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh , and you can make an soft link to /usr/local/bin as

ln -s /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh /usr/local/bin/virtualenvwrapper.sh, and everything you can just follow the setup guide as the official document does. Good luck!


回答 8

对我来说是:

~/Library/Python/2.7/bin/virtualenvwrapper.sh

(对于OS X,带有pip install --user安装)

For me it was in :

~/Library/Python/2.7/bin/virtualenvwrapper.sh

(With OS X, with a pip install --user installation)


回答 9

我也有同样的问题。如果您使用的是virtualenvwrapper的旧版本,则pip无法正常工作。

http://pypi.python.org/pypi/virtualenvwrapper/3.6 和python setup.py安装文件下载src 。然后问题解决了。

I have the same problem. If you have older version of virtualenvwrapper, then pip wont work.

download src from http://pypi.python.org/pypi/virtualenvwrapper/3.6 and python setup.py install. Then the problem solved.


回答 10

对于基于RPM的发行版(如Fedora 19),运行sudo pip install virtualenvwrapper命令后,您可以在以下位置找到文件:

/usr/bin/virtualenvwrapper.sh

For RPM-based distributions(like Fedora 19), after running the sudo pip install virtualenvwrapper command, you may find the file at:

/usr/bin/virtualenvwrapper.sh

回答 11

使用普通用户在Ubuntu 15.10上使用pip安装了它,并~/.local/bin/virtualenvwrapper.sh通过运行找到了它:

$ find / -name virtualenvwrapper.sh 2>/dev/null

Installed it using pip on Ubuntu 15.10 using a normal user, it was put in ~/.local/bin/virtualenvwrapper.sh which I found by running:

$ find / -name virtualenvwrapper.sh 2>/dev/null


回答 12

使用

find / -name virtualenvwrapper.sh

我收到大量“拒绝权限”的信息,并且只有一个文件位置的打印输出。我错过了它,直到我用pip再次卸载/安装该文件时找到了该文件位置。

万一你好奇,那是在

/usr/local/share/python/virtualenvwrapper.sh

Using

find / -name virtualenvwrapper.sh

I got a TON of “permissions denied”s, and exactly one printout of the file location. I missed it until I found that file location when I uninstall/installed it again with pip.

In case you were curious, it was in

/usr/local/share/python/virtualenvwrapper.sh

回答 13

就我而言(OSX El Capitan,版本10.11.5),我需要按如下方式编辑.profile:

在终端中:

vim〜/ .profile

export WORKON_HOME=$HOME/.virtualenvs
export MSYS_HOME=C:\msys\1.0
source /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh                                                                                   

然后重新加载配置文件(它将在当前会话中可用。)

来源〜/ .profile

希望它会帮助某人。

In my case (OSX El Capitan, version 10.11.5) I needed to edit the .profile like so:

In the terminal:

vim ~/.profile

export WORKON_HOME=$HOME/.virtualenvs
export MSYS_HOME=C:\msys\1.0
source /Library/Frameworks/Python.framework/Versions/2.7/bin/virtualenvwrapper.sh                                                                                   

And then reload the profile (that it will be availuble in the current session.)

source ~/.profile

Hope it will help someone.


回答 14

我在玩virtualenvwrapper-4.8.4时可以在macOS Mojave(10.14)中找到一个

/Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvwrapper.sh

I can find one in macOS Mojave (10.14) while playing with virtualenvwrapper-4.8.4

/Library/Frameworks/Python.framework/Versions/3.7/bin/virtualenvwrapper.sh


回答 15

尽管这是OS X的问题,但这是在Linux(Red Hat)上对我有用的东西。

我的virtualwrapper.sh在

~/.local/bin/virtualenvwrapper.sh

这可能是因为我使用--user标记在本地安装了virtualenvwrapper …

pip install --user virtualenvwrapper

……作为替代冒险的做法使用sudo pip

Although this is an OS X question, here’s what worked for me on Linux (Red Hat).

My virtualwrapper.sh was in

~/.local/bin/virtualenvwrapper.sh

This is probably because I installed virtualenvwrapper locally, using the --user flag…

pip install --user virtualenvwrapper

…as an alternative to the risky practice of using sudo pip.


回答 16

/usr/share/virtualenvwrapper/virtualenvwrapper.sh

我已经在Ubuntu 16.04上安装了它,并找到了这个位置。

/usr/share/virtualenvwrapper/virtualenvwrapper.sh

I’ve installed it on Ubuntu 16.04 and it resulted in this location.


回答 17

/usr/local/bin/virtualenvwrapper.sh
/usr/local/bin/virtualenvwrapper.sh

回答 18

小猎犬骨头黑(debian)也有同样的问题。

手动下载软件包并安装对我有用。

I had the same issue in with the beagle bone black(debian).

Manually downloading the package and installing worked for me.


回答 19

对于Ubuntu,
如果您刚刚安装了它,请检查Terminal上的输出,我在发布我的:

Running setup.py install for virtualenv-clone    
Installing virtualenv-clone script to /home/username/.local/bin
Successfully installed virtualenvwrapper virtualenv virtualenv-clone stevedore pbr six
Cleaning up...

第二行告诉您路径。对我来说/home/username/.local/bin

For Ubuntu
If you just installed it, check the output on Terminal, I’m posting mine :

Running setup.py install for virtualenv-clone    
Installing virtualenv-clone script to /home/username/.local/bin
Successfully installed virtualenvwrapper virtualenv virtualenv-clone stevedore pbr six
Cleaning up...

Here the second line tells you the path. For me it was at /home/username/.local/bin


回答 20

点子不会试图让您为难。

问题是基于命令的文件始终安装在/bin文件夹中,它们可以位于系统路径上的任何位置。

我遇到了同样的问题,发现我的文件中有这些文件

~/.local/bin/

文件夹而不是

/usr/loca/bin/

这是常见的情况,但我认为他们将默认路径更改为

~ 或$ HOME

目录,因为它对pip安装更隔离,并提供了apt-get软件包和pip软件包之间的区别。

所以说到这里,您有两种选择,要么转到 .bashrc,然后进行如下更改

# for virtualenv wrapper
export WORKON_HOME=$HOME/Envs
export PROJECT_HOME=$HOME/Devel
source $HOME/.local/bin/virtualenvwrapper.sh

然后在下面创建目录virtualenvwrapper/usr/share/然后像这样符号链接您的virtualwrapper_lazy.sh

sudo ln -s ~/.local/bin/virtualenvwrapper_lazy.sh /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh

并且您可以检查您的workon命令是否正在运行,该命令将列出您现有的virtualenv。

pip will not try to make things difficult for you on purpose.

The thing is commands based files are always installed in /bin folders they can be anywhere on the system path.

I had the same problem and I found that I have these files in my

~/.local/bin/

folder instead of

/usr/loca/bin/

which is the common case, but I think they changed the default path to

~ or $HOME

directory because its more isolate for the pip installations and provides a distinction between apt-get packages and pip packages.

So coming to the point you have two choices here either you go to your .bashrc and make changes like this

# for virtualenv wrapper
export WORKON_HOME=$HOME/Envs
export PROJECT_HOME=$HOME/Devel
source $HOME/.local/bin/virtualenvwrapper.sh

and than create a directory virtualenvwrapper under /usr/share/ and than symlink your virtualwrapper_lazy.sh like this

sudo ln -s ~/.local/bin/virtualenvwrapper_lazy.sh /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh

and you can check if your workon command is working which will list your existing virtualenv’s.


回答 21

如果您pip install virtualenvwrapper不使用sudo来执行,那么普通的用户pip将运行,但由于缺少权限而不会在所需位置复制文件

mortiz@florida:~# sudo pip3 install virtualenvwrapper

使用sudo,文件将在它们各自的路径下创建:

root@florida:/usr/local/bin# ls -ltr
total 8008
-rwxr-xr-x 1 root staff 8136192 Jun 11 17:45 chromedriver
-rwxr-xr-x 1 root staff   41697 Sep  5 16:06 virtualenvwrapper.sh
-rwxr-xr-x 1 root staff    2210 Sep  5 16:06 virtualenvwrapper_lazy.sh
-rwxr-xr-x 1 root staff     215 Sep  5 16:06 pbr
-rwxr-xr-x 1 root staff     218 Sep  5 16:06 virtualenv-clone
-rwxr-xr-x 1 root staff     213 Sep  5 16:06 virtualenv
root@florida:/usr/local/bin# 

在Debian GNU / Linux 9上为我工作

If you execute pip install virtualenvwrapper without sudo as a normal user pip will run but won’t copy the files in the required locations because the lack of permissions.

mortiz@florida:~# sudo pip3 install virtualenvwrapper

Use sudo and the files will be created under their respective paths:

root@florida:/usr/local/bin# ls -ltr
total 8008
-rwxr-xr-x 1 root staff 8136192 Jun 11 17:45 chromedriver
-rwxr-xr-x 1 root staff   41697 Sep  5 16:06 virtualenvwrapper.sh
-rwxr-xr-x 1 root staff    2210 Sep  5 16:06 virtualenvwrapper_lazy.sh
-rwxr-xr-x 1 root staff     215 Sep  5 16:06 pbr
-rwxr-xr-x 1 root staff     218 Sep  5 16:06 virtualenv-clone
-rwxr-xr-x 1 root staff     213 Sep  5 16:06 virtualenv
root@florida:/usr/local/bin# 

Worked for me on Debian GNU/Linux 9


回答 22

就我而言:/home/username/.local/bin/virtualenvwrapper.sh

in my case: /home/username/.local/bin/virtualenvwrapper.sh


回答 23

您是否使用sudo安装了它?在我的情况下是错误。

Have you installed it using sudo? Was the error in my case.


声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。