简体   繁体   中英

Module Not Found - virtual Environment

I am getting in error I am currently using mac

I have created a virtual environment - name of virtual environment: venv

Even if I have installed the modules I am getting module not found error.

I have tried many things pip list gave me output which shows that the pandas is installed

I also did -> sys.path

The path to my virtual environment is this: /Users/nidhivanjare/Desktop/ML/venv

The reason might be because you transferred your virtual environment folder to another location (or you copied it from another computer)

This is how to fix it:

  1. Open the /Scripts/activate file inside your virtual environment folder.
  2. Go to the line that has this:

VIRTUAL_ENV="$(if [ "$OSTYPE" "==" "cygwin" ]; then cygpath -u 'Z:\<your NEW folder>'; else echo '/Z/<your NEW folder>'; fi;)"

  1. Change the path to the new location of your virtual environment.

    Change it from

Z:\<your OLD folder> and /Z/<your OLD folder>

 to

Z:\<your NEW folder> and /Z/<your NEW folder>

  1. If you are using the Command Prompt of Windows, you also have to change the path in the file /Scripts/activate.bat

set "VIRTUAL_ENV=Z:\<folder>"

The standard venv needs a dot before the activate command, like . ./venv/bin/activate . ./venv/bin/activate . The first dot is your shell's source command.

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