I'm using CentOS 7 and want to run a "virtualenv" command. So I tried uninstalling and re-installing it ...
[myuser@server ~]$ sudo pip uninstall virtualenv
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Cannot uninstall 'virtualenv'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
[myuser@server ~]$ sudo pip install virtualenv
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: virtualenv in /usr/lib/python2.7/site-packages (15.1.0)
but when I go to actually run it, I'm told its not installed.
[myuser@server ~]$ virtualenv myenv
Traceback (most recent call last):
File "/usr/bin/virtualenv", line 2, in <module>
import virtualenv
ModuleNotFoundError: No module named 'virtualenv'
WTF??
You can just remove virtualenv rm -r ./your_venv
and after that create new one python3 -m virtualenv your_venv
and activate this source ./your_venv/bin/activate
. Now you are in separated environment. In this state you can install your libs pip install -r ./requirements.txt
for example. The libs are going to install only inside your environment, not globally.
try python -m virtualenv myenv
. The -m
flag means module. With this command, you are explicitly telling python to run the module virtualenv
as a script.
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.