Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
195 views
in Technique[技术] by (71.8m points)

python - Using virtualenv with spaces in a path

I set up a virtualenv environment on my Mac, but cannot get Pip to install packages. It fails with the following error:

/Volumes/Macintosh: bad interpreter: No such file or directory

I tracked the problem down to there being a space in the path, as is answered here: https://stackoverflow.com/a/10873611/126564
(the path being /Volumes/Macintosh HD/Python/my_project)

But that's a bit of a problem. The proposed solution is to:

"just put your virtualenv environment in a path without a space,"

but the part with the space is the volume itself. All of my paths would have a space, unless I stored them in a directory of /. And I don't think "store your stuff outside of user space" is a good solution.

Is there a better solution to this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Trying this:

  • editing bin/activate, change VIRTUAL_ENV='/Volumes/Macintosh HD/Python/my_project', and change PATH="$VIRTUAL_ENV/bin:$PATH", to make it work in your environment. using echo $PATH to check if it works.
  • editing bin/pip and bin/easy_install, change first line in the two files to

    #!/usr/bin/env python

After above 2 steps, you'll make your virtualenv works(also pip/easy_install).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...