简体   繁体   中英

Unable to Install Packages in VIrtual Environment Python 2.7 Ubuntu 17.10

In My Environment i have Python 3.6.3 Installed Via Anaconda and i also have Python 2.7(Came With Distro).So i am trying to create a virtual environment for this course Course Link as the code is in Python 2.7.

So i create a virtualenv with virtualenv --python= "python2.7 path" "path to project directory"

Then i activate the given virtual environment but while installing,i get a error like this 错误图片

Any idea how i can rectify this?

The issue is that you are trying to create your virtual environment with spaces in the path name. You should set up your virtual environment at a path without any spaces.

When you set up an environment, all of the scripts and executables relating to that environment are placed in the bin directory. Some of the scripts reference interpreters such as bash. In the case of a bash script, the #! first line of the script will evaluate incorrectly as it comes across a space. In your case, these scripts are starting with the following first line:

 #!/home/dhruv/Python 2.7 venv/bin/python

Note that this will cause errors because the script will be intepreted as the command /home/dhruv/Python with the arguments 2.7 and venv/bin/python . ie it is looking for an interpreter /home/dhruv/Python (which does not exist) and it is trying to give it two arguments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM