In the ubuntu environment, I made a soft link between python and python3.6 (ln -s python python3.6), and I made a soft link with pip, so after installing virtualenvwrapper with pip, start virtualenvwrapper at source. When sh and workon virtual environment always report an error:
1 ./virtualenvwrapper.sh: line 230: : command not found 2 virtualenvwrapper.sh: There was a problem running the initialization hooks. 3 4 If Python could not import the module virtualenvwrapper.hook_loader, 5 check that virtualenvwrapper has been installed for 6 VIRTUALENVWRAPPER_PYTHON= and that PATH is 7 set properly.
This is the statement on line 230 according to the hint:
1 "$VIRTUALENVWRAPPER_PYTHON" -m 'virtualenvwrapper.hook_loader' \
Combined with the error message and the sentence found in the prompt, it is guessed that there should be a problem with VIRTUALENVWRAPPER_PYTHON, and then look for VIRTUALENVWRAPPER_PYTHON in the virtualenvwrapper.sh file, and find the key points:
1 # Locate the global Python where virtualenvwrapper is installed. 2 if [ " ${VIRTUALENVWRAPPER_PYTHON:-} " = "" ] 3 then 4 VIRTUALENVWRAPPER_PYTHON = " $(command \which python3) " # It was originally written \which python, here The one posted is after I modified it to python3. 5 fi
VIRTUALENVWRAPPER_PYTHON is used (Locate the global Python where virtualenvwrapper is installed.) to locate which python has virtualenvwrapper installed. The location originally specified is python, which is version 2.7. Since I installed it using python3.6 before, I need to change it to python3 here. Then the error disappeared.
The advantage of using virtualenvwrapper is that you don’t need to use source /xxx/virtual environment/bin/activate every time to start the virtual environment. Configure it in ~/.bashrc. You can directly use the workon command to open the virtual environment in the future. The specific steps and premise You have installed python-virtualenv:
# Setup: # 1. Create a directory to hold the virtual environments. # (mkdir $HOME/.virtualenvs). # 2. Add a line like "export WORKON_HOME=$HOME/.virtualenvs" # to your .bashrc. # 3. Add a line like "source /path/to/this/file/virtualenvwrapper.sh" # to your .bashrc. # 4. Run: source ~/.bashrc # 5. Run: workon # 6. A list of environments, empty, is printed. # 7. Run: mkvirtualenv temp # 8. Run: workon # 9. This time, the "temp" environment is included. # 10. Run: workon temp # 11. The virtual environment is activated.
Read More:
- [Solved] umi Project Create Error: Rendered more hooks or Rendered fewer hooks
- Hive Error: FAILED: RuntimeException Error loading hooks(hive.exec.post.hooks): java.lang.ClassNotFoundException: org.apache.atlas.hive.hook.HiveHook
- How to Solve hadoop3.x.x sh start-dfs.sh Startup Error
- .sh error: ***.sh: 2: set: Illegal option – Solution
- [Solved] elasticsearch.bat Running Flashback.: Error occurred during initialization of VM, Error occurred during initializatio
- An error was reported when Maven package was running the packaged jar package: there is no main list attribute in xxx.jar, which can be solved by configuring Maven plugin
- Taro Use React Hooks Error: TypeError: Object(…) is not a function
- [Solved] Initialization error encountered by JUnit unit test: Method initialization error not found
- start-all.sh Execute error: Stopping journal nodes [slave2 slave1 master]…
- Mac Error: sh: vue-cli-service: command not found
- Mac error: SH: Vue cli service: command not found
- [Solved] FileUploadException: the request was rejected because no multipart boundary was found
- file_name.sh: 3: Syntax error: “(“ unexpected [How to Solve]
- How to Solve bootstrap.sh error during the construction of fabric environment
- ./get_datasets.sh Error: permission denied [How to Solve]
- Maven Configurate Error: [ERROR] Error executing Maven. [ERROR] 1 problem was encountered while building the effec
- [Solved] SHELL Run Error: “-BASH: ./TEST.SH: /BIN/BASH^M: BAD INTERPRETER: NO SUCH FILE OR DIRECTORY”
- [Solved] ora 01033 linux,ORA-01033: ORACLE initialization or shutdown in progres
- [Solved] CUDA error:-UserWarning: CUDA initialization: CUDA unknown error
- Error occurred during initialization of VM Could not reserve enough space for 1572864KB object heap
Thank you it worked i was having trouble each time i installed this on a new workstation
Thank you, worked for me. Clear and efficient !